faqts : Computers : Programming : Languages : PHP : Common Problems : Forms and User Input : URLs and Post or Get Methods

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 18 people (44%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

how do i send a send a variable to a new html page that will dynamically use it

Jul 15th, 2003 06:46
Lyon O, ben reece,


Well, you start off by passing a variable to the new web page either by 
using a hidden value in a form or the URL.  I usually use the URL like 
this: $i is the variable you want to pass to web.html, so <a 
href="web.html?i=yes">link</a> would cause $i to equal "yes" on 
web.html.
To make the page dynamically pick up the variable, you would simply use 
an if statement.  Let's say you want to use $_SERVER[PHP_SELF].  This 
comes in handy because you could then say if($i) { blah, blah } or if(!
$i) {}.  This method works very well.  Hope I helped.