faqts : Computers : Programming : Languages : PHP

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

Entry

Could someone help with code that sends a number of variables to a php page when a link is clicked?

Mar 24th, 2008 20:32
ha mo, Jason Benson, david,


QueryStrings are accessible from your php page natively.
Example Link:
A user clicks on http://example.com/myscript.php?myname=Jason&mycat=Foo
In the example, notice the "?myname=Jason&mycat=Foo" string at the end 
of your URL.
To get these values in your PHP page, use the $_GET method.
Example Script
<?
echo "Hello " . $_GET['myname'];  // outputs "Hello Jason"
echo "How is " . $_GET['mycat'] . " today?"; //outputs "How is Foo 
today?";
?>
The $_GET, $_POST and $_REQUEST variables are predefined variables in 
PHP for handling information that your webserver receives in different 
ways.  See http://us3.php.net/manual/en/reserved.variables.php for more 
information.
Hope that helps
JB
http://www.tantofa.com
http://www.fantofa.com
http://www.mantofa.com
http://www.tanpola.com
http://www.tampola.com
http://www.yamot.com
http://www.mozmar.com
http://www.templatestemp.com