我正在尝试将post
数据形成为mysql
. 但我对所有角色都感到非常困惑和厌倦。我想我缺少一些字符或添加了太多字符!php
请帮我将此表格传递到mysql
.
浏览器对此行错误作出反应:
"'" . $_POST['credit_card_expiration'] ."',".);
这是代码:
<?php
session_start(); // Start session first thing in script
// Script Error Reporting
error_reporting(E_ALL);
ini_set('display_errors', '1');
// Connect to the MySQL database
include "storescripts/connect_to_mysql.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
//let's create the query
$insert_query = "INSERT INTO order (".
"name,".
"email_address,".
"membership_type".
"terms_and_conditions,".
"name_on_card,".
"credit_card_number,".
"credit_card_expiration_data,".
") values
(".
"'" . $_POST['name'] . "', ".
"'" . $_POST['email_address'] . "',".
"'" . $_POST['membership_type'] . "',".
"'" . $_POST['terms_and_conditions'] . "',".
"'" . $_POST['name_on_card'] . "',".
"'" . $_POST['credit_card_number'] . "',".
"'" . $_POST['credit_card_expiration'] ."',".);
//let's run the query
mysql_query($insert_query);
?>
</body>
</html>
我的表格:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<form method="post" action="form_process.php">
Name on card:
<input type="text" name="name_on_card"><br />
Credit card number:
<input type="text" name="credit_card_number"><br />
Credit card Expiration date:
<input type="text" name="credit_card_expiration_date"><br />
<input type="hidden" name="name"
value="<?php echo $_POST['name']; ?>">
<input type="hidden" name="email_address"
value="<?php echo $_POST['email_address']; ?>">
<input type="hidden" name="membership_type"
value="<?php echo $_POST['membership_type']; ?>">
<input type="hidden" name="terms_and_conditions"
value="<?php echo $_POST['terms_and_conditions']; ?>">
<input type="submit" value="Submit">
</form>
</body>
</html>