Hi,
I am trying to execute the following script, but each time it is failing and returning "Unable".
Note: "Unable" is the response returned when isset($_POST) is not working, refer the code for more details.
PHP CODE
<?php
$test = "Hi!";
if ((isset($_POST['usrName'])) && (isset($_POST['pWord'])))
{
$user = $_POST["usrName"];
$pass = $_POST["pWord"];
$con = mysql_connect("","root","");
if(!$con)
{
die("Could not connect!");
echo "Fail";
}
mysql_select_db("learn", $con);
mysql_query("INSERT INTO loginrecords (Username, Password)
VALUES ('$user', '$pass')");
mysql_close($con);
echo "Success!";
echo $test;
echo $user;
echo $pass;
}
else
{
echo "Unable";
}
?>
HTML FORM CODE ONLY
<form action="CreateUser.php" method="post">
<table class=CreateUser cellpadding=4px, cellspacing=2px>
<tr class=TableHeading>
<td colspan=2>Enter the infomation below</td>
</tr>
<tr class=FormContents>
<td>Username</td>
<td><input type=text id=usrName size=20px></input>
</td>
</tr>
<tr class=FormContents>
<td>Password</td>
<td><input type=password id=pWord size=20px></input>
</td>
</tr>
<tr class=FormContents>
<td></td>
<td align=right><input type=submit id=Cu_Bt value=Login></td>
</tr>
</table>
</form>
Thanks!