1
This is just a test page I am working on. Trying to get my submit button to load the next page "order.php"
It just keeps loading the same page. Should I be writing this in PHP or HTML?
If you look at my submit button, I am thinking this should work.
<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
require_once('connect2db.php');
if(isset($_POST["action"])){
$customer = $_POST['customer'];
$Email = $_POST['Email'];
$query = "INSERT INTO tbl_cust
(CName, email)
VALUES
(:customer, :Email)";
$sth = $db->prepare($query);
$sth->bindValue(':customer', $customer, PDO::PARAM_STR);
$sth->bindValue(':Email', $Email, PDO::PARAM_STR);
$sth->execute();
echo 'Form Submitted and data saved!';
}
?>
<!DOCTYPE html>
<html class="html" lang="en-US">
<head>
<meta http-equiv="Content-type" content="text/html; <title>Home</title>
</head>
<body>
<div class="clearfix" id="page">
<form class="form-grp clearfix colelem" id="widgetu75" method="post" enctype="multipart/form-data" action="">
<input type="hidden" name="action" value="submit-form">
<label>Name:</label>
<input class="wrapped-input" type="text" spellcheck="false" id="widgetu86_input" name="customer" tabindex="1"/>
<label>Email:</label>
<input class="wrapped-input" type="text" spellcheck="false" id="widgetu82_input" name="Email" tabindex="2"/>
<input class="submit-btn NoWrap grpelem" id="u81-17" type="submit" value="Submit" href="order.php" target="_blank"" ttabindex="3"/>
</form>
</div>
</body>
</html>
2try changing your action from "" to "order.php" – cybernard – 2015-10-11T22:48:17.087
it worked. i'm a bonehead. :) – David – 2015-10-12T00:05:45.587
Glad I could help. I have made simple mistakes that way also. – cybernard – 2015-10-12T00:07:17.147
@cybernard better post your comment as answer, so it would be easier for other users to know that this question has been answered already. – artsylar – 2015-10-19T06:43:33.363