Pass value to header?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
When processing a form I am reading in a value to a mysql database. I then  
redirect the user to a "thank you" page with Header. What I would like is to  
remind the user the value he/she keyed in. Can I pass the variable in the  
Header command?

What I want to do in the following is echo the value of $inx01 in  

mysql_connect(" Codes Removed ") or die(mysql_error());
mysql_select_db(" Database Name removed ") or die(mysql_error());


mysql_query("INSERT INTO table1 VALUES ('$inx01')");
echo mysql_error();


Header("Location: ");


Garry Jones

Re: Pass value to header?

Garry Jones wrote:
Quoted text here. Click to load it


Quoted text here. Click to load it

There are two different methods you can use:
1) Put the value into a session variable.  Before the 'header()"
function, put

$_SESSION['inx01'] = $inx01;

Then in the thankyou.php script, you can get the value by referencing

Be sure you put


at the start of each script.

2) Pass the value on the URL:

header('Location: =' .

and the you can use the value in $_GET['inx01']


Site Timeline