Re: Pass value to header?



Garry Jones wrote:
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?

[snip]

Header("Location: http://www.mydomain.com/thankyou.php";);
exit;


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
$_SESSION['inx01']

Be sure you put

session_start();

at the start of each script.

2) Pass the value on the URL:

header('Location: http://www.mydomain.com/thankyou.php?inx01=' .
$inx01);

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

Ken

.



Relevant Pages

  • Re: Re: cant get header() to redirect
    ... I see the URL of the page containing the header() statement, ... Any php script that I put on the server that has an error like a missing ... >> SignUp.php back to SignUp.php, perform the validation, and redirect ...
    (comp.lang.php)
  • Re: Serving files and redirecting using headers.
    ... > I have a page where form data is passed to a php page (just script) to ... The second header is never called. ... If you redirect before sending the file ... Provide a link to download the file and another link for the 'redirect'. ...
    (comp.lang.php)
  • Re: [SLE] Down load count?
    ... >> and have the CGI generate a redirect to the actual PDF. ... > You can serve a stream of bytes through a php script. ... if you specify an attachment name in the header, ...
    (SuSE)
  • Re: "headers already sent" madness
    ... script for the connection to DB and then somewhere below this process a ... form and if all is good execute a redirect using the header() function. ... connection details on the actual page which isnt something that i want ...
    (comp.lang.php)
  • Re: New record saved when Refresh clicked
    ... but the method to redirect the browser using the ... header will not function if any output takes place in your script. ... you can't append or otherwise modify the header when you ...
    (comp.lang.php)