Submitted form won't change the values in the database

U

user6594014

Guest
I have a DATABASE with users and their emails, but can't add new users from the code. I have a form located in C:\xampp\htdocs but when try to add a user through the form, nothing happens. I can only make changes in pma.


<?php
$pdo = new PDO('mysql:host=localhost;port=3306;dbname=misc',
'fred', 'zap');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);


<?php
require_once "pdo.php";

if ( isset($_POST['name']) && isset($POST['email'])
&& isset($_POST['password'])) {
$sql = "INSERT INTO users (name, email, password)
VALUES :)name, :email, :password)";
echo("<pre>\n".$sql."\n</pre>\n");
$stmt = $pdo->prepare($sql);
$stmt->execute(array(
':name' => $_POST['name'],
':email' => $_POST['email'],
':password' => $_POST['password']));

}
?>
<html>
<head></head><body>
<p>Add a New User</p>
<form method="post">
<p>Name:
<input type="text" name="name" size="40"></p>
<p>Email:
<input type="text" name="email"></p>
<p>Password:
<input type="password" name="email"</p>
<p><input type="submit" value="Add New"/></p>
</form>
</body>

Continue reading...
 
Top