HI all,
I am really struggling here with something that is probably really simple.
I have the following code
<?php
include 'connection.php';
try {
$conec = new Connection();
$con = $conec->Open();
$sql = "INSERT INTO `user`(`name`, `email`) VALUES (:name,:email)";
$pre = $con->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
if($pre->execute(array(':name' => 'Name', ':email' => 'Email'))){
echo "Successful";
}
} catch (PDOException $ex) {
echo $ex->getMessage();
}
?>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<div>
<form>
<input type="text" name="Name" placeholder="Name"></input>
<input type="text" name="Email" placeholder="Email Address"></input>
<button type="submit" name="submit"></button>
</form>
</div>
<script type="text/javascript">
</script>
</body>
</html>
All I am wanting to do is tell this bit of code to use the fields I have in the form for name and email and put their content into the database.
Currently it is just putting “name” and “email” into the database.
I would like this to run when the button is clicked.
Thanks in advance