这只是我正在制作的一个测试页面。尝试让我的提交按钮加载下一页“order.php”
它只是不断加载相同的页面。我应该用 PHP 还是 HTML 来编写它?
如果你看我的提交按钮,我认为这应该有效。
<?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>
答案1
尝试将您的操作从“”更改为“order.php”