note 90612 added to function.array-search

From: Date: Thu, 30 Apr 2009 13:35:42 +0000
Subject: note 90612 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-154041@lists.php.net to get a copy of this message
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? ---- Server IP: 209.41.74.194 Probable Submitter: 70.88.243.88 ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- https://master.php.net/note/edit/90612 Del: integrated -- https://master.php.net/note/delete/90612/integrated Del: useless -- https://master.php.net/note/delete/90612/useless Del: bad code -- https://master.php.net/note/delete/90612/bad+code Del: spam -- https://master.php.net/note/delete/90612/spam Del: non-english -- https://master.php.net/note/delete/90612/non-english Del: in docs -- https://master.php.net/note/delete/90612/in+docs Del: other reasons-- https://master.php.net/note/delete/90612 Reject -- https://master.php.net/note/reject/90612 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#154041) next »