malikah Posted April 8, 2007 Share Posted April 8, 2007 Hi, I would like to know how the "test.php" page should receive the following code: <a href=test.php?vid="12345">Go!</a> Thanks! Link to comment https://forums.phpfreaks.com/topic/46098-send-to-another-php-page/ Share on other sites More sharing options...
SyLon Posted April 8, 2007 Share Posted April 8, 2007 Using the $_GET[] variable, like this: <? $vid=$_GET['vid']; $vid will be now 12345 ?> Link to comment https://forums.phpfreaks.com/topic/46098-send-to-another-php-page/#findComment-223994 Share on other sites More sharing options...
curtis_b Posted April 8, 2007 Share Posted April 8, 2007 also the original link should not have quotes around the variable value. <a href="test.php?vid=12345"> Link to comment https://forums.phpfreaks.com/topic/46098-send-to-another-php-page/#findComment-223995 Share on other sites More sharing options...
malikah Posted April 8, 2007 Author Share Posted April 8, 2007 Using the $_GET[] variable, like this: <? $vid=$_GET['vid']; $vid will be now 12345 ?> Hmm.. Didn't seem to work, but this did!: $foo=$_GET['vid']; echo ($foo); Thanks anyway Link to comment https://forums.phpfreaks.com/topic/46098-send-to-another-php-page/#findComment-223997 Share on other sites More sharing options...
SyLon Posted April 8, 2007 Share Posted April 8, 2007 $vid=$_GET['vid']; DOES worked. You only added an echo function to output it.. Link to comment https://forums.phpfreaks.com/topic/46098-send-to-another-php-page/#findComment-224008 Share on other sites More sharing options...
HaLo2FrEeEk Posted April 8, 2007 Share Posted April 8, 2007 Yes, use the code he posted: <?php $vid = $_GET['vid']; echo $vid; // or code to do whatever with $vid ?> You do not have to print out the contents of $vid, I usually only use that for debugging purposes, just to check step by step my scripts, you can do whatever you want with $vid. Link to comment https://forums.phpfreaks.com/topic/46098-send-to-another-php-page/#findComment-224010 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.