odd thing with php processing using POST -
i have project works on test server stopped working when moved onto another. think it's php ma here ask opinion. main page html login has form post calls php script file, this:
<form method="post" action="prologin.php"> name: <input type="text" name="nam"><br> password: <input type="password" name="pas"><br> <input type="submit" value="login" data-inline="true" data-icon="gear"> </form>
an prologin.php file looks this:
<?php session_start(); include 'mycon.php'; $nume1=mysql_real_escape_string( $_request['nam'] ); $pass1=mysql_real_escape_string( $_request['pas'] ); $s = "select * uzers uzname = '$nume1' , pass = md5('$pass1')"; var_dump($s); ... followed other validations , stuff.
when run html file , click submit button (login), receive "undefined" page in chrome or firefox, , when "view source" see sql above empty values. is:
string(56) "select * uzers uzname = '' , pass = md5('')"
what wrong? why php not receive request variables? because assume happens. can fix it?
this happens when first loading page before submitting form, @ case $_request or $_post not exists, can avoid checking variables:
if(isset($_request['nam']) && isset($_request['pas'])){ include 'mycon.php'; $nume1=mysql_real_escape_string( $_request['nam'] ); $pass1=mysql_real_escape_string( $_request['pas'] ); $s = "select * uzers uzname = '$nume1' , pass = md5('$pass1')"; //other staff }
Comments
Post a Comment