Page 1 of 1

Getting Information From One Page To Another

Posted: Mon May 15, 2006 5:06 pm
by Darksevear
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

Posted: Mon May 15, 2006 5:11 pm
by RobertGonzalez

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;
}
?>