PHP Newbie - Form Help

Hi,

New here and looking for a bit of help or at least pointing in the right direction. I am fairly new to PHP and at the moment just banging my head against the desk with this lol

Basically what I am trying to do is create a one field form and when it submits it redirects to a different url and no database, the more complicated bit (for me any way) is I want it to redirect to different url’s for different codes entered…for example I enter HNNN and it redirects to site.com/blah , I enter JJGSand that redirects to site.com/blah55

Is this even possible, I’m sure it is and I think just need pointing in the redirection. I am really new to PHP so learning slowly as I go along.

Thanks in advance.

Shell

What you can do is the following:

[code]$location = “http://default.website.com”;

if ($_POST[‘form_element’] == “someValue”) {
$location = “http://first.website.com”;
} elseif ($_POST[‘form_element’] == “someOtherValue”) {
$location = “http://second.website.com”;
}

header("Location: ".$location);
exit;[/code]

Sponsor our Newsletter | Privacy Policy | Terms of Service