Code Won't Run--Error, Newbie

Hi!
So I am new to PHP. My code will not run and I am wondering if someone can help me.

<?php

if ($_SERVER["REQUEST_METHOD"] == "POST") {

  // collect value of input field

  $user = $_POST['user'];

  $pw = $_POST['pw'];

  if (empty($user) or empty($pw) ) {

    echo "try again";

  } else {

    echo $user." ".$pw."<br>";

  }

}

$login = array("Scott"=>"Awakening", "Brittney"=>"Legacy", "Grant"=>"Apex", "Andrew"=>"Immortal");

$role = array("Scott"=>"play drums", "Brittney"=>"sing", "Grant"=>"play guitar", "Andrew"=>"play guitar")

// add $login array here

// add $role array here

$f = 0;

// add foreach() loop here. See instruction on ELMS for additional code.

if($x == $user AND $x_value == $pw) {

    $f = 1;

  echo "Hi, I'm " .$x ." and I " .$role[$user] ." for Unleash the Archers. Watch the video for our song ";

  echo '<a href="https://youtu.be/mWuM9CkY3U8", target = "_blank">Legacy</a>';

  echo "<br>";

}

if($login == 0) {

  echo "incorrect password, try again";

}

?>

Where does $x and $x_value magically come from? If you turn on error reporting Php will be happy to tell you many of the things wrong.

Sponsor our Newsletter | Privacy Policy | Terms of Service