PHP redirecting

Hello Everybody :slight_smile:

I am new to php. I am building a multipage form.
On the second page of the form I have two submit buttons. One for going back to page 1 and the other to proceed to page 3.
The form action will go to a script that will lookup which button was pressed, saves to session and loads the correct page.

I need help with the code for the redirecting.

[php]<?php
$value1 = $_POST[“button19”];
$value2 = $_POST[“button141”];

if ($value1 or $value2 == “Personalien”) {
header(“Location: http://example.com/Page1.php”);
}
if ($value1 or $value2 == “Adressen”) {
header(“Location: http://example.com/Page3.php”);
}
?>[/php]

That’s what I have so far. I assume it’s totally wrong :smiley: How do I approach this correctly?

Thanks in Advance!

Your if statement’s syntax is incorrect. You need to compare each variable to the value. However, if you explicitly name the controls, you will have a better idea of what the intention is.

$_POST[‘button1’] vs $_POST[‘btnNext’]

There is a clear intention of the latter, while the former makes you wonder what it is to begin with.

Sponsor our Newsletter | Privacy Policy | Terms of Service