Passing information to new page

Hi. I’m a total newbe, so I expect there is a very simple answer to this.
My page reg1.php?ser=12345 contains this line:
$serialnumber = htmlspecialchars($_GET[“ser”]) ;
After submitting a form the user is redirected to ser2.php and I want the serial number to go with it. I have:
$thankyou_page = “reg2.php?ser=”;
What is the syntax for including $serialnumber please.

If you are using a form, it would be better to use the $_POST method. That way you simply can do this

[php]$serialNumber = $_POST[‘ser’];[/php]

If you first page is just using a get then use the $_GET method.

On the page you are using a form then simply use a hidden type for an input element, maybe something like?

[php][/php]

Thanks for responding Strider64. Maybe I should explain what I’m doing.
The user arrives on reg1.php with ser=12345
$serialnumber = htmlspecialchars($_GET[“ser”]) ;
A form asks for his name and email address and this information is emailed to me.
I then want him taken to reg2.php where he receives a registration code based on the serial number
Is it possible to include the serial number in this line?
$thankyou_page = “reg2.php?ser=”;

If they are filling out a form why not include a hidden field?
[php] [/php]

Then you process the form simply do something the the following -

[php]$ser = $_POST[‘ser’];
/* After you process all the other stuff and want to thank the user then do -> */
header(“Location: reg2.php?ser=” . $ser);
exit();[/php]

Of course for reg2.php you’ll have to use the $_GET statement again…

HTH John

It works. Many thanks.
But I have another question.
How do I include the serial number in an email?

$ser = $_POST[‘ser’];
$email_message .= “Name: “.clean_string($full_name).”\r\n”;
$email_message .= “Email: “.clean_string($email_from).”\r\n”;
$headers = 'From: ’ . $email_to . “\r\n”.'Reply-To: ’ . $email_to."\r\n" . ‘X-Mailer: PHP/’ . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
header(“Location: reg2.php?ser=” . $ser);

Just add another line in the message, preferably with the full url so the receiver can just click on it to activate

I want a line that says "Your serial number is: " followed by the serial number

Here I give you what I do for my own website which in turn should show you how to do it
[php]$comment = “Thank you for taking your time and registering at Slice of Pi website.\n Please click or copy the full URL and paste it in your browser: https://www.pepster.com/confirm.php?confirm_number=” . $confirmationNumber;[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service