I've spent about 6 hours now trying to set up a simple system, while part of it worked in the end the below does not for some reason.
The problem is that while it puts the username and a md5 hash into the database, for level, (which is either 1 or 2, 1 to use the information, 2 to add to it as well) it does not, it just puts 0 into the database each time and I have no idea why!
Please help!
<?php
$lv1 = "lv1";
$lv2 = "lv2";
if (($user == "") || ($password == "") || ($level == "")) {echo "Please enter information";}
?>
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
User Name<INPUT TYPE="text" NAME="user" SIZE="20" MAXLENGTH="30">
Password<INPUT TYPE="text" NAME="password" SIZE="20" MAXLENGTH="30">
Authorisation Level:<select name="level">
<option value="<?php echo $lv1 ?>">Member
<option value="<?php echo $lv2 ?>">Admin
</select>
<INPUT TYPE=SUBMIT NAME="submit" VALUE="Submit">
</FORM>
<?php
$encpw=md5($password);
include ("connect.inc");
$query = "INSERT INTO table_name (user,password,level) VALUES ('$user','$encpw','$level');";
$result = mysql_query($query);
mysql_close();
?>
Thanks for any assistance, this is driving me crazy.