note 90612 rejected from function.array-search by thiago

From: Date: Thu, 30 Apr 2009 13:36:57 +0000
Subject: note 90612 rejected from function.array-search by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154043@lists.php.net to get a copy of this message
Note Submitter: tima129 at aim dot com ---- I'm truing to get the array_search to search for a predetermined variable from a login page. My login page looks like this:<body> <form action="login2.php" method="post" name="login"> Username: <input type="text" name="username" /> Password: <input type="password" name="password" /> <br /> <input name="Submit" type="submit" value="submit" /> <input type="reset" /> </form> </body> and my PHP on the login2.php is this: <?php $loginPass = $_POST["password"] ; // Gets password from pasword box and sets it to a php variable (loginPass) $loginName = $_POST["username"] ; // Gets login name from login box and sets it to a php variable (loginName) $userName = array(0 => 'Peter', 1 => 'Glen', 2 => 'Joe', 3 => 'Cleveland');// creates array to hold usernames $password = array(0 => 'Griffin', 1 => 'Quagmire', 2 => 'Swanson', 3 => 'Brown');// creates array to hold passwords $key = array_search($loginPass, $userName); echo $key; ?> it doesent return anything ?? any ideas?

« previous php.notes (#154043) next »