我一直有语法错误,意外的 $end。
我检查了我的代码,但没有任何问题。我检查了所有的开始和结束括号。似乎是什么问题?
我的代码:
<?php
setcookie('name',$_POST['name']);
setcookie('lname',$_POST['lname']);
setcookie('add',$_POST['add']);
setcookie('age',$_POST['age']);
setcookie('contact',$_POST['contact']);
setcookie('email',$_POST['email']);
setcookie('user',$_POST['user']);
setcookie('pass',$_POST['pass']);
$con=mysql_connect("localhost","root","");
mysql_select_db("nnx",$con);
$tbl=mysql_query("SELECT * FROM tablename WHERE `username` = '".mysql_real_escape_string($_POST['user'])."'");
while($row=mysql_fetch_array($tbl))
{
if($_POST['user']==$row['username'])
{
header("location: /register.php?codeErr2=1");
die;
}
$name=$_POST['name'];
$lname=$_POST['lname'];
$add=$_POST['add'];
$age=$_POST['age'];
$contact=$_POST['contact'];
$email=$_POST['email'];
$user=$_POST['user'];
$pass=$_POST['pass'];
if(($name!="")&&($lname!="")&&($add!="")&&($age!="")&&($contact!="")&&($email!="")&& ($user!="")&&($pass!=""))
{
$value=mysql_query("INSERT INTO tablename(name, lastname, address, age, contact, email, username, password)
VALUES ('".$_POST['name']."','".$_POST['lname']."','".$_POST['add']."','".$_POST['age']."','".$_PO ST['contact']."','".$_POST['email']."','".$_POST['user']."','".$_POST['pass']."')");
}
else
{
header("location: /register.php?codeErr=1");
}
?>
<html>
<body bgcolor="green">
<center>
<h1>Welcome! These are the offered products</h1>
<table border="1" width="1000" height="500" bgcolor="yellow">
<tr>
<th>Product</th>
<th>Description</th>
</tr>
<tr>
<td>GARLIQUE</td>
<td>GARLIQUE
The All Natural Dietary Supplement
Produced from fresh garlic
</td>
</tr>
<tr>
<td>Right-CEE</td>
<td>Right-CEE (Sodium Ascorbate) …
</td>
</tr>
<tr>
<td>OLEIA</td>
<td>OLEIA CAPSULE
No More Pain, Heart to Gain
</td>
</tr>
</table>
<br>
<br>
<form name="product" action="order.php" method="post">
<input type="submit" value="Order">
</form>
</body>
</html>