Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 18th, 2010, 02:29 PM
Friend of Wrox
Points: 550, Level: 8
Points: 550, Level: 8 Points: 550, Level: 8 Points: 550, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , , .
Posts: 112
Thanks: 12
Thanked 0 Times in 0 Posts
Default Straight HTML code passing variables from one page to another...

Hi to all....

i'm creating straight HTML pages since this laptop will have no internet and so on...
user will enter data on one page, pass it to the next page and print...

i've beening using javascript asp pages passing variables from one page to another...
with NO problems...ex.:
<%
varName= QueryString("Name")
%>

how would i do this with straight HTML...

Thanking you in advance...

Rino
Reply With Quote
  #2 (permalink)  
Old June 18th, 2010, 04:15 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Use JavaScript to create the equivalent collection for use by other JS code:
Code:
<script type="text/javascript">
var querystring = [ ];
var qs = location.search;
if ( qs.length > 1 )
{
    qs = qs.substring(1); // skip past the ?
    var pairs = qs.split( /\&/g ); // get all the name=value pairst
    for ( var p = 0; p < pairs.length )
    {
        var pair = pairs[p];
        querystring[ pair[0] ] = unescape( pair[1].replace(/\+/g," ");
    }
}
</script>
Then, anyplace in your page where in ASP code you might use
Code:
     var foo = Request.QueryString("foo");
you instead simply do
Code:
    var foo = querystring["foo"];
CAUTION: "foo" will be case sensitive, unlike in ASP. If you wish, you could replace
Code:
        querystring[ pair[0] ] = unescape( pair[1].replace(/\+/g," ");
with
        querystring[ pair[0].toLowerCase() ] = unescape( pair[1].replace(/\+/g," ");
and then always use lower case names ("foo" in place of "Foo" or "FOO") when finding values.

Untested, though I have used this same code before. If there's a goof, it's just a typo.
Reply With Quote
  #3 (permalink)  
Old June 18th, 2010, 04:16 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

And of course all your Response.Write's become document.write( ). And other considerations. But you get the idea.
Reply With Quote
  #4 (permalink)  
Old June 19th, 2010, 01:40 PM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

XHTML is part of the front-end developer's holy trinity: XHTML, CSS, Javascript. XHTML handles the primary document structure of XHTML elements. CSS handles page appearance. Javascript handles page behavior.

The boundaries are a little slippery but basically that's the difference; so if you want to work with variables like in a server side language, the structure of XHTML elements can't do that. You need Javascript, which is why Old Pedant has put together this beautifully designed script.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
Reply With Quote
  #5 (permalink)  
Old June 21st, 2010, 03:24 PM
Friend of Wrox
Points: 550, Level: 8
Points: 550, Level: 8 Points: 550, Level: 8 Points: 550, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , , .
Posts: 112
Thanks: 12
Thanked 0 Times in 0 Posts
Default

Thank you for your re-ply...

maybe i should have asked this question from the beginning...

the reason why i asked is because on my laptop "notebook" home edition which does not come with iis... my pages i created are .asp but when i open them up in browser it opens up the code instead... how can i view the page instead of the code???
Reply With Quote
  #6 (permalink)  
Old June 21st, 2010, 03:59 PM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Ahhhh... OK, that does explain your situation much better.

XHTML, CSS, and Javascript all work in a browser. You can use them freely.

Most everything else, ASP, .NET, PHP, Java, etc. are server-side languages. That's why your ASP files are producing code instead of the actual web page you want. The .asp file is a mix of XHTML and your ASP code. However, your .asp files needs some kind of processor to read your ASP code, react to it, and render the appropriate XHTML-only document which it then sends to the user's browser (in this case... You!)

Server side processors are pre-installed or you have to manually install them so the server knows how to interpret the code you're passing to it. Since you don't have IIS, a standard server-side processor isn't going to work, because there's no server to make use of it when you try to access a page.

I would say your best bet is to download Visual Studio 2010 Express. It has a development server that corresponds very well to IIS (as in, I can't remember a discrepancy between my development and production server in the five years I've been programming). You start up one of your applications and it allows you to work in code and test the results live. It's a feature called edit and continue, but you'll just care that it reduces your risk as you program your modules. That being said, I've never tried to use it with ASP files. As long as an ASP processor is installed on your computer, I think it should work. (for all I know, it's probably built into windows or the .NET framework).

The flip side is that ASP is definitely not a current generation technology, so if you haven't started programming in .NET already, this might be the perfect time to jump into C#.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
Reply With Quote
  #7 (permalink)  
Old June 22nd, 2010, 06:10 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Actually, you can't run ASP on some versions of Windows. For the simple reason that ASP in turn requires the IIS web server and MicroSlop just decided to deny it to "home" users. I know you can't do it with XP Home Edition and I don't believe you can do it with Vista Home Basic.

This also means you can't run ASP.NET pages on those systems using IIS. But you *can* still develop ASP.NET on them, because Visual Studio (even the free Express editions) includes a built-in mini-web-server (which is only capable of serving up HTML and ASP.NET pages).

But running an application "under" Visual Studio is not something you would ordinarily want to do. Okay if it's only for your own use, but surely you wouldn't give that to anybody else (among other things, any silly slip-up by them could do untold damage to your files).

In practice, if you want to use ASP or ASP.NET pages via http://localhost you need to install IIS. And that means you need to upgrade from the Home Edition to the next step up. (WIndows Vista Home Premium, for example, is what I use for both ASP and ASP.NET and yes, it includes a [somewhat limited] version of IIS.)

Failing all this, you could install an Apache web server on virtually any operating system and run PHP pages. Or install Tomcat and run JSP. Only MicroSquish knows why they think home users don't deserve even a miniature web server.
Reply With Quote
  #8 (permalink)  
Old June 22nd, 2010, 06:53 PM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Interesting, that's good to know since I've never worked with ASP.

RinoDM, everything Old Pedant said is true; though the mini-server in the express editions of VS is just fine for development and then you can deploy your site to a producation server. As long as you have access to a .NET enabled hosting account, even shared hosting is usually fine (just check to see if you have access to your email accounts from the application (including backend credentials) and what database options you have available.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
Reply With Quote
  #9 (permalink)  
Old June 22nd, 2010, 07:39 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

But that doesn't help him.

See his first post:
Quote:
i'm creating straight HTML pages since this laptop will have no internet and so on...
user will enter data on one page, pass it to the next page and print...
Quite frankly, even though it may mean some rewriting, I can't see why you couldn't/wouldn't use the technique I showed: Replace the ASP code with ordinary client-side JS scripting. Oh, there will be other changes, but if the ASP code isn't very complex you should be able to make it all work.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing variables from HTML to php manunair PHP How-To 9 April 9th, 2006 11:27 PM
Passing Session Variables to the Next Page jim.sullivan@telus.net ASP.NET 1.0 and 1.1 Professional 1 August 1st, 2004 06:25 PM
Passing Session Variables to the Next Page jim.sullivan@telus.net Classic ASP Databases 2 August 1st, 2004 01:59 PM



All times are GMT -4. The time now is 09:01 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.