swirly
Active Member
- Messages
- 1,930
- Reaction score
- 0
- Points
- 36
well that was the wrong code i figured out...but now i got the right one...but its not working....its for people to add names and passwords etc..but its not submitting, and i copied it straight out of the book. did i just spell something. heres the code...
Code:
<html>
<head>
<title>Add User</title></head>
<?php
if( (!$firstname) or (!$lastname)
or (!$username) or (!$password) )
{
$form ="Please enter all new user details...";
$form.="<for action=\"$PHP_SELF\"";
$form.=" method=\"post\">First Name: ";
$form.="<input type=\"text\" name\"firstname\"";
$form.="value=\"$firstname\"><br>Last Name: ";
$form.="<input type=\"text\" name\"lastname\"";
$form.="value=\"$lastname\"><br>User Name: ";
$form.="<input type=\"text\" name\"username\"";
$form.="value=\"$username\"><br>Password: ";
$form.="<input type=\"text\" name\"password\"";
$form.="value=\"$password\"><br>";
$form.="<input type=\"submit\" value=\"Submit\">";
$form.="</form>";
echo($form);
}
else
{ $conn = @mysql_connect("localhost", "swirlys", "friends")
or die("Could not connect to MYSQL");
$db = @mysql_select_db("swirlys_user", $conn)
or die("could not select database");
$sql = "insert into users
(first_name,last_name,user_name,password) values
(\"$firstname\",\"$lastname\",\"$username\",
password(\"$password\") )";
$result =@mysql_query($sql,$conn)
or die("Could not execute query");
if($result) {echo("New user $username added"); }
}
?></body</html>
Last edited: