我正在使用isset
函數來檢查提交按鈕是否被點擊,但它不起作用。它沒有輸入if
。這是我的代碼。我沒有得到問題仍然存在的地方。isset提交不起作用
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><h2><br />
User Registration</h2>
<p> </p></td>
</tr>
<tr>
<td>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form1" id="form1" onsubmit="return Validate();">
User Name[E-mail ID]: <input type="text" name="username" style="width:230px; height:20px;" /><br /><br />
Password : <input type="password" name="password" style="width:230px; height:20px;" /><br /><br />
Name <input type="text" name="name" style="width:230px; height:20px;" /><br /><br />
Contact Number: <input type="text" name="phone" style="width:230px; height:20px;" /><br /><br />
Email: <input type="text" name="email" style="width:230px; height:20px;" /><br /><br />
<input type="submit" value="REGISTER" />
</form>
<?php
include('connect.php');
if (isset($_POST['submit']))
{
echo "1";
$username = $_POST['username'];
echo $username;
$password = $_POST['password'];
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
//$id = $_GET['aid'];
$sql = "INSERT INTO user_info(application_id, username, password, name, contact, email) VALUES (" . $aid. ", " .$username.", ".$password.", ".$name.",". $phone.", ".$email.") ";
echo $sql;
mysql_query($sql) or die(mysql_error());
//header("Location: index1.php");
}
?>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
請讓我知道我要去哪裏錯了。
我認爲你的HTML是錯誤的(你沒有提供提交字段元素的名稱屬性)。你需要這樣的東西:''在PHP中,您需要調用'isset($ _ POST ['mysubmit'])' –