jeudi 22 septembre 2016

i was doing php forms , and the else statement is only being ouputed

here is the code - i dont where the problem is...

My form:

  <form action="process1.php" method="post" >   
    first name : <input type="text" name="first name" value="" />
    password : <input type="password" name="pasword" value= "" />
    <br/>
    <input type="submit" name="submit" value="submit" />
    </form>

process1.php

    <?php
    $users = array("abhishek","alan" ); # was doing to limit the users  
    if (firstname == $users ){
        $firstname = $_post['firstname'];
        $password  = $_post[ 'password'];
        echo "$firstname" . "and". "$password"; 
    }else { 
        echo "access denied";
    } 
     ?>

Even if I type abhishek or alan the output is showing access denied:

Notice: Use of undefined constant firstname -  
assumed 'firstname' in F:\wamp\www\php_sandbox\process1.php on line 9     
access denied

Aucun commentaire:

Enregistrer un commentaire