vendredi 2 octobre 2015

open new page based on combobox choice and click button [duplicate]

This question already has an answer here:

i have combobox code like this

<form action="plot.php" method="POST">
        &nbsp;&nbsp;Variabel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
        <select name="variabel">
        <option value="no2">NO2</option>
        <option value="so2">SO2</option>
        <option value="ozone">ozone</option>
        <option value="aerosol">aerosol</option>
        </select>
        <input type="submit" value="plot" style="width:500px;height:48px">

and in file named "plot.php" like this

<?php
  $variabel = $_POST['variabel'];

  if ($variabel = "no2") {
  header("location:maps_no2.php");
  }
  else if ($variabel = "so2")
  {
  header("location:maps_so2.php");
  }
  else if ($variabel = "ozone")
  {
  header("location:maps_ozone.php");
  }
  else 
  {
  header("location:maps_aerosol.php");
  }
?>

all i want is when i pick one of the item in my combobox, it will be the parameter for the other page to open after i click "plot" button. for the example, when i pick NO2, maps_no2.php will show. when i try that code above, it just work on the first condition, although i pick so2. how can i solve this? anyone?? please.




Aucun commentaire:

Enregistrer un commentaire