Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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
  #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.
  #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.
  #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.
  #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???
  #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.
  #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.
  #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.
  #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.


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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.