ottoman_ Posted December 12, 2008 Share Posted December 12, 2008 as u can see , the form submits info into vars $user and $passswd in php section the problem i am getting is that when i echo these vars , nothing shows up meaning they are empty while input is present in form and i click check the mysql thing works fine i have checked it by hardcoding my row variables i confused why the input is not coming to php section thankyou in advance <?php session_start(); // start up your PHP session! ?> <html> <body> <!-- a new form to hold our text fields , username and password--> <form new_from="aa.php" method=Check> <!-- my_from_page.php is actual page hosted on the webserver being accessed--> username <input type=text name='uname'> <br /> <!-- username is field , its name used by parser is username and type is text--> password<input type=password name='passwd'> <br /> <!-- name of textfield is passwd , the varibale name i maen used by parser--> <input type=submit value=Check > <p> <!-- when u click on button named check , the info is submitted , actually php takes over--> </form> <?php $user=$_Check[uname]; $passwd=$_Check[passwd]; mysql_connect("localhost", "root", "sa") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); $result = mysql_query("SELECT count(id) from usr where passwd = '$passwd' ") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo $row[0]; if( $row[0] !=1) echo "no"; else echo "yes"; Link to comment https://forums.phpfreaks.com/topic/136671-form-varibles-empty-problem/ Share on other sites More sharing options...
rhodesa Posted December 12, 2008 Share Posted December 12, 2008 change your form method to POST and use this to get your form data instead: $user=$_POST['uname']; $passwd=$_POST'passwd']; p.s. - Where did you get a method of "Check"? Link to comment https://forums.phpfreaks.com/topic/136671-form-varibles-empty-problem/#findComment-713611 Share on other sites More sharing options...
jcombs_31 Posted December 12, 2008 Share Posted December 12, 2008 what is this? <form new_from="aa.php" method=Check> Link to comment https://forums.phpfreaks.com/topic/136671-form-varibles-empty-problem/#findComment-713615 Share on other sites More sharing options...
rhodesa Posted December 12, 2008 Share Posted December 12, 2008 yeah, that too...where did you get this form code from? Link to comment https://forums.phpfreaks.com/topic/136671-form-varibles-empty-problem/#findComment-713616 Share on other sites More sharing options...
jcombs_31 Posted December 12, 2008 Share Posted December 12, 2008 It should read <form action="aa.php" method="post"> Link to comment https://forums.phpfreaks.com/topic/136671-form-varibles-empty-problem/#findComment-713624 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.