Search the Community
Showing results for tags 'input'.
-
Hey, I am currently reading the book, and have made my own register form and php script. There is no problems with the database connection, but it just will not insert information into the database. The MySQL database is named 'test' and the table 'users'. The table has user_id, first_name, last_name, email, pass and registration_date columns. here is the registration form: <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body><link rel="stylesheet" type="text/css" href="style.css"> <form action="script4.php" method="post"> <p>First Name:<input type="text" name="first_name" /></p> <p>Last Name:<input type="text" name="last_name" /></p> <p>Email: <input type="text" name="email" /></p> <p>Password: <input type="password" name="pass1" /></p> <p>Confirm Password: <input type="password" name="pass2" /></p> <input type="submit" name="submit" value="Submit!" /> </form> </body> </html> and here is script4.php : <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php $first_name = $_REQUEST['first_name']; $last_name = $_REQUEST['last_name']; $email = $_REQUEST['email']; $pass1 = $_REQUEST['pass1']; $pass2 = $_REQUEST['pass2']; require ('mysql_connect.php'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $errors = array();} if (!empty($_POST['first_name'])) { $errors[] = "You forgot to enter your first name!"; } else { $fn = trim($_POST['first_name']); } if (!empty($_POST['last_name'])) { $errors[] = "You forgot to enter your first name!"; } else { $ln = trim($_POST['last_name']); } if (!empty($_POST['email'])) { $errors[] = "You forgot to enter your first name!"; } else { $e = trim($_POST['email']); } if (!empty($_POST['pass1'])) { if ($_POST['pass1'] != $_POST['pass2']) { $errors[] = "Your passwords do not match."; } else { $p = trim($_POST['pass1']);} }else { $errors[] = "You forgot to enter your password."; } if (empty($errors)) { require ('mysql_connect.php'); @mysqli_query("INSERT INTO users (first_name, last_name, email, pass, registration_date) VALUES($first_name, $last_name,$email, SHA1($pass), NOW() )");} ?> </body> </html> Please can someone help me. I am using WAMP server by the way.
-
On my registration page, I would like to allow my clients to select from two different options as roles they can have when they register for the website. The first role is "member", the second is "manager". I can't find any resources on how the syntax should work with the create_form_input tag to allow the user to select one of those two options and store it in the database under the "type" field. Please help! Jim
- 1 reply
-
- registration
- form
-
(and 3 more)
Tagged with: