asherinho Posted July 8, 2008 Share Posted July 8, 2008 Hi! I have a log in form which takes user name and password,but the information in these fields seems not be fetched by the php page & I get a message "You forgot to enter the username or password" whenever I enter the username & password.here are the codes for the form and php page <form action="login.php" method="post"> <B>USER NAME</B> <INPUT type="text" name="uname" size="25"><BR><BR> <B>PASSWORD</B> <INPUT type="password" name="pass" size="25"><BR><BR> <INPUT type="submit" name="submit" size="30" value="LOGIN"> </form> if($uname && $pass){ if($logged_in_user==$uname){ if($record["status"]=="administrator"){require("iframe_adm.php"); exit;} elseif($record["status"]=="user"){require("iframe_usr.php"); exit; } echo "<B style='color:red;font-size:15px'>YOU ARE ALREADY LOGGED IN!</B><BR>"; } $db=mysql_connect("localhost","root"); mysql_select_db("ppra_flis",$db); $result=mysql_query("select * from login where uname='".$uname."' and pass='".$pass."'"); if(!$result){echo "error in query";} if(mysql_num_rows($result) > 0){ $logged_in_user=$uname; session_register("logged_in_user"); while($record=mysql_fetch_assoc($result)){ if($record["status"]=="administrator"){require("iframe_adm.php"); exit;} elseif($record["status"]=="user"){require("iframe_usr.php");exit;} } exit; } else{require("top.php"); echo "<B style='color:red;font-size:15px'>Wrong username or password</B>";} } else{require("top.php"); echo "<B style='color:red;font-size:15px'>You forgot to enter the username or password</B>";} Link to comment https://forums.phpfreaks.com/topic/113691-getting-info-from-a-text-field/ Share on other sites More sharing options...
bluejay002 Posted July 8, 2008 Share Posted July 8, 2008 you need to use $_POST for that. Say, $_POST['uname'] and $_POST['pass'] Link to comment https://forums.phpfreaks.com/topic/113691-getting-info-from-a-text-field/#findComment-584252 Share on other sites More sharing options...
wrathican Posted July 8, 2008 Share Posted July 8, 2008 all i can do reccomend some easy reading. W3Schools is a good place to start: http://www.w3schools.com/php/php_forms.asp and this is about a login system, as i didnt quite understand what was going on in your script: http://phpeasystep.com/workshopview.php?id=6 Good Luck! Link to comment https://forums.phpfreaks.com/topic/113691-getting-info-from-a-text-field/#findComment-584255 Share on other sites More sharing options...
asherinho Posted July 8, 2008 Author Share Posted July 8, 2008 It is working but I am getting this warning and I don't know how to solve it Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 Link to comment https://forums.phpfreaks.com/topic/113691-getting-info-from-a-text-field/#findComment-584265 Share on other sites More sharing options...
bluejay002 Posted July 9, 2008 Share Posted July 9, 2008 what PHP version are you using? Or are you using deprecated functions or whatsoever on later versions of PHP, say PHP 5? Link to comment https://forums.phpfreaks.com/topic/113691-getting-info-from-a-text-field/#findComment-584969 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.