jeudi 16 février 2017

if elseif else preg_match windows location

I am creating a form where i want that if someone answer is a certain number like 2 or 7 the will be directed to diffrent pages.

I searched online and came up making this.

<?php
// define variables
$name "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {
 if (!preg_match("/^3/",$name)) {
      echo "<meta http-equiv="refresh" content="0; URL=http://google.nl/">";
 } elseif (!preg_match("/^9/",$name)) {
      echo "<meta http-equiv="refresh" content="0; URL=http://osm.nl/">";
 }
   else {
      echo "<meta http-equiv="refresh" content="0; URL=http://facebook.nl/">";
}

}
?>

First i tested it by creating a validation form, which works fine. Trough research i edited the code. But now when i tried to open the page it is point blank.

How do i fix it that i can redirect the inputs

Aucun commentaire:

Enregistrer un commentaire