Hi again,
I have another newbie problem. I’m trying to create a simple script that processes a form. When submitted it takes users to a certain page.
The form uses radio buttons and when submit is clicked it ‘should’ take you to your selected page. What it’s doing is taking me to the same page for each option.
Here is the code I’m using:
foreach ($_POST as $field => $value)
if ($field = "addcategory")
{
header("location: ChooseHorseCat.php");
}
elseif ($field = "addhorse")
{
header("location: AddHorse.php");
}
elseif ($field = "deletehorse")
{
header("location: DeleteHorse.php");
}
elseif ($field = "mainpage")
{
header("location: HorseCatalog.php");
exit();
}
ChooseHorseCat.php is the page I’m taken to for each option.
I’ve checked all the name cases in the form etc.
Can someone see what I’m doing wrong? Can I not use ‘header’ this way? Does the first use override using it again?
Also, when I tried making the last elseif, just else, I got an error saying “unexpected ‘{’ on line …etc” I’m not sure why.
Does anyone have any suggestions as to what’s wrong or perhaps another way to do it?
I could use just hyperlinks I know, but I like the idea of using buttons to do it. Plus, lol, I’m stubborn I guess.