Jump to content

jsk1gcc

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by jsk1gcc

  1. hi again, having trouble getting the result from the drop down box to direct to another page the if statement works when i don't try and do anything with it. should the IF statement go on another page and the submit button POST the $result, i'm really not sure. any help would be great.. code so far index.php <?php $query = "SELECT * FROM `ride` ORDER BY name"; $result = mysql_query($query); echo"<select name='name'><option value=''>Select Ride</option>"; while( $row = mysql_fetch_array($result) ) { echo '<option>'.$row['name'].'</option>'; } echo '</select>'; mysql_free_result( $result ); //// do rest of form when done///// echo "<form method=post name=f1 action='dd-check.php'>"; echo "<input type=submit value=Submit>"; echo "</form>"; ?> dd-check.php <?php $result =$_POST['WHAT GOES HERE?']; <-----------???? is this even needed? echo "Ride Choosen = $result"; <-----------???? how do i get the $result from index.php? if ($result == "Swinging Ship") { header('Location: Swing.php'); } elseif ($result == "Roller Coaster") { header('Location: Roller.php'); } elseif ($result == "Ice Blast") { header('Location: Ice.php'); } else { echo "choose a ride"; } ?>
  2. Thankyou x
  3. Hi, I've been researching and all I can find is information on how to change URLS not how to redirect a user if statement matches input. I don't think this makes any difference but the $result comes from a drop down box. (if that code is needed, let me know) I would like something like this: if $result="Swinging Ship" GO TO PAGE <a href="Swing.php">Ultra Rides</a> if $result="Roller Coaster" GOT TO PAGE <a href="Roller.php">Ultra Rides</a> if $result="Ice Blast" GO TO PAGE <a href="Ice.php">Ultra Rides</a> I need the syntax for this, should I use a loop, if else, while maybe? not sure what to use. thanks for any help on this.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.