Hi,
I have the code below and it doesnt seem to be inserting anything into the db, Could anyone help and is tehre a way to make sure that it has entered correctly without selecting?
Steven
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>New Admin</title>
<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
<?php
include_once('connect.php');
if (empty($_POST['submit']))
{
} else {
if (empty($_POST['name']) || empty($_POST['pass']))
{
echo "<div class=\"text\">Please fill in all fields.</div>";
} else {
$name = stripcslashes($_POST['name']);
$pass = stripcslashes($_POST['pass']);
$permission = '1';
$fpass = md5($pass);
$ip = $_SERVER['REMOTE_ADDR'];
$query = mysql_query("INSERT INTO users (`username` , `password` , `permissions` , `ip`) VALUES ('$name', '$fpass', '$permission', '$ip'");
if (isset($query)) {
echo "<div class=\"text\">User successfully added.</div>";
}
}
}
?><div class="text">
Enter the details for the new admin below. <br /><br />
<form name="newuser" method="POST" action="newadmin.php">
Username: <input type="text" name="name" /><br /><br />
Password: <input type="password" name="pass" /><br /><br />
<input type="submit" name="submit" value="Add user" />
</form></div>
</body>
</html>