代码没有进入signup_ad.php
signup_ad.php:
<? php
mysql_connect("localhost","root","") or die("not connected");
mysql_select_db("sample") or die("no db found");
if(isset($_POST)
{
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$query= "insert into signup(fname,lname) values('$fname','$lname')";
$result=mysql_query($query);
if (!$result) {
$message='invalid query';
die($message); }
}
?>
值没有进入db ..也没有给出任何错误。我需要包含我的signup_ad.php文件吗?
signup.php:
<form action="signup_ad.php" method="post" >
<label>
First Name
</label>
<input type="text" required autocomplete="off" name="fname" />
<label>
Last Name
</label>
<input type="text" required autocomplete="off" name="lname"/>
<button type="submit" class="button button-block" name="btn-signup" value="submit" action="login.php" />Get Started</button>
答案 0 :(得分:1)
你忘了分号前的引号:
$query= "insert into signup(fname,lname) values('$fname','$lname')";