mercredi 2 janvier 2019

PHP elseif challenges [duplicate]

This question already has an answer here:

I'm trying to write an 'elseif' statement that redirect people to different URLs based upon values submitted on a previous page.

Here's my statement. It doesn't seem to do anything.

I HAVE created all of the session variables. I can read / display them on the HTML page. However the PHP 'elseif' statement doesn't seem to do anything. I had previously written this in ASP many years ago but can't get it to work in PHP.

<?php

if ($_SESSION['busseatsneeded'] <= 7)
    {header("Location: submit-RAMBLIN.php");}

elseif ($_SESSION['tripsize'] == "individual")
    {header("Location: submit-RAMBLIN.php");}

/** This redirects specifically for wedding shuttle auto responder page*/

elseif ($_SESSION['popularrequests'] == "local wedding shuttle")
    {header("Location: submit-RAMBLIN-WEDDING.php");}


/** This redirects specifically for boy scouts auto responder page */
elseif ($_SESSION['popularrequests'] == "boy scouts")
    {header("Location: submit-RAMBLIN-BOY-SCOUTS.php");}


/** Closer To = Denver AND Popular Request = Casino Day Trip */
elseif ($_SESSION['popularrequests'] == "casino day trip" AND $_SESSION['closerto'] = "Denver")
    {header("Location: submit-RAMBLIN-DENVER-CASINO.php");}


/** Closer To = Colorado Springs AND Popular Request = Casino Day Trip */
elseif ($_SESSION['popularrequests'] == "casino day trip" AND $_SESSION['closerto'] = "Colorado Springs")
    {header("Location: submit-RAMBLIN-COLORADO-SPRINGS-CASINO.php");}


/** Closer To = Black Hawk / Central City AND Popular Request = Casino Day Trip */
elseif ($_SESSION['popularrequests'] == "black hawk central city" AND $_SESSION['closerto'] = "Denver")
    {header("Location: submit-RAMBLIN-BLACK-HAWK-CENTRAL-CITY-CASINO.php");}

else
    {header("Location: submit-RBS.php");}

?>

Aucun commentaire:

Enregistrer un commentaire