I have read many tutorials on POST and GET. But i cant seem to get a variable from one page to another can someone please advise how to do this.
I just need to get a variable from a.php to b.php, a.php has a link to b.php
- Cheers, Daniel
Getting Information From One Page To Another
Moderator: General Moderators
-
Darksevear
- Forum Newbie
- Posts: 11
- Joined: Sat May 13, 2006 10:38 pm
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Code: Select all
<?php
// This is a.php
echo '<a href="b.php?somevar=thisvalue">Go to page b</a>';
?>Code: Select all
<?php
// this is b.php
if (isset($_GET['somevar']))
{
$myvar = $_GET['somevar'];
// validate the var value here then echo it out
echo $myvar;
}
?>