I have a site with some code which checks the value of a field in a database table, and controls which page a user goes to when they hit the submit button on a form.
It is part of a shopping cart, where a few optional extras are offered along the way.
I have added a new option for a different size of cushions, but can't get the syntax right, or am going wrong somewhere.
I have this code in my header:
$row = mysql_fetch_assoc($result);
if (!@empty($_POST)) {
$_SESSION["basket"]["items"][$_POST["id"]]["paintwork"] = $_POST["colour"];
if (@empty($row["cushions"])) {
$url = "accessories.php?id=" . $_REQUEST["id"];}
elseif (@empty($row["cushions2"])) {
$url = "accessories2.php?id=" . $_REQUEST["id"];
} elseif (!@empty($row["glasstop"])) {
$url = "glasstop.php?id=" . $_REQUEST["id"];
} else {
$url = "shopping_cart.php";
}
And this code in my form button:
<a href="<?php echo (!@empty($row["cushions"])) ? "shopping_cart.php" : "accessories.php?id=" . $_REQUEST["id"]?>" style="float: left; color: #251717; background-color: #DBC87B">NO THANKYOU, PROCEED WITH ORDER</a>
How can amend that so that it will go to the accessories.php page or the accessories2.php page?