• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Passing Variables

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am building a logon page using javascript and the database is in XML
once the user logs on they are directed to a new page depending on what type of user they are!
is there anyway i can use the username which has been entered in the logon and pass the details to the page they are directed to???/
tahnks
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is alot easier when you are using a serverside language with posting a form and it is more secure to do it.
Can you do it with JavaScript, in some ways yes...
Method 1: Query String
Method 2: Cookies
The forum here uses both methods...The query String is used to determine what the page does and the cookies store your username...
If you want more informtion, just ask...
Eric
 
Roisin Dunne
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so how do i use the query string method?
im not sure about the cookies as most browsers dont support them anymore do they?
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All browsers support cookies unless a person turns them off, this site uses them as I said before.

Query String...easy....
on the page you want to get the value
say the URL was:
http://thepage.com?forum=20
all you would need to do is the following

You can use the "get" method with a form for the query string. The method above only assumes that there is going to be one value in your QS.
Eric
 
Roisin Dunne
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry
rite but my page doesnt have a ? after it!the varable is simply in a textbox on that page!how can i refernce it on next page?
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you have to make it have a query string with either a form or adding to the url and sending it to the next page...
1)Form using Get
2)document.loaction.href= "http://url" + "?theVar=" + yourVar;
3)Cookies...
4)Use a server side language
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic