我正在發送數據到一個PHP文件,它顯示它的HTML表單...最終我會有PHP發送數據到MySQL數據庫。當我提交我的形式,我得到一個PHP錯誤:T_VAR錯誤與PHP
Parse error: syntax error, unexpected T_VAR in /home2/rocksoli/public_html/webscan/trucheckupdates/mySQL-test/sql_submit.php on line 2
這是我的HTML文件:
<html>
<head>
<title>Webscan Test Form</title>
</head>
<body>
<form name="test" action="sql_submit.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="hidden" name="formname" value="test" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
,這是PHP:
<html>
<?php
var $name = $_POST['name'];
var $age = $_POST['age'];
var $formname = $_POST['formname'];
if (!(empty($name))&&!(empty($age))&&!(empty($formname))) {
var $received = true;
}
else {
var $received = false;
}
?>
<head>
<title>Confirmation Page</title>
</head>
<body>
<p>Your input to the form: <?php echo $formname;?> was <?php if (!$received) {echo "not";}?>received.</p>
</body>
</html>
非常感謝你們現在的作品。我要開始添加數據庫的東西 – diracdeltafunk 2011-06-15 18:09:29