-1

So i have this html form that connects to a php script on the same page. the way it should work is that you enter a form (selcect). the output goes trough a elseif to check all the posible outputs. But this doenst work, the vars dont change at all.

The thing I tried are setting the vars to null at the beginning and restarting my XAMPP enviroment, both didnt work.

html:

  <form method="POST">
    <select name="sLand">
      <option value="NED">Nederland</option>
      <option value="BEL">Belgiƫ</option>
      <option value="LUX">Luxemburg</option>
      <option value="GER">Duitsland</option>
    </select>
    <input type="submit" value="Bestel">
  </form>

php:

$sLand = "sLand";
$sLand = $_POST['sLand'];


if($sLand = "NED")
  $sOutput = ("test");
elseif($sLand = "BEL")
  $sOutput = ("test 2");
elseif($sLand = "LUX")
  $sOutput = ("test 3");
elseif($sLand = "GER")
  $sOutput = ("test 4");

echo($sLand);
echo($sOutput);

1 Answers1

0

You need to use two = signs to compare values:

if ($sLand == "NED")

instead of

if ($sLand = "NED")

and so on

Dmytro Huz
  • 1,514
  • 2
  • 14
  • 22