我想为网站制作一个简单的登录表单
<form action="ContactFormHandler.php" method="post">
<table>
<tr>
<td>
Username:
</td>
<td>
<input type="text" id="username" name="username" />
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="text" id="password" name="password" />
</td>
</tr>
<tr>
<td>
Your Email:
</td>
<td>
<input type="text" id="Email" name="Email" />
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center;">
<input type="submit" id="submit" value="Submit" />
<input type="reset" id="reset" value="Reset" />
</td>
</tr>
</table>
</form>
</body>
你看到它说联系表单处理程序的地方了吗?我希望表单和处理表单的文件是同一个文件。2 合 1。
如何将此联系人处理程序包含在联系表单的同一文件中?
<?php
$contactName = $_POST["ContactName"];
$contactEmail = $_POST["ContactEmail"];
$contactPassword = $_POST["ContactLeastFavoriteColor"];
$sql_connection = mysql_connect("localhost", "root", "root");
mysql_select_db("MyRadContactForm", $sql_connection);
$sql = "INSERT INTO MyRadContacts (
ContactName,
ContactEmail,
ContactPassword,
ContactDateCreated
)
VALUES (
'$contactName',
'$contactEmail',
'$contactPassword',
NOW()
)";
mysql_query($sql, $sql_connection);
mysql_close($sql_connection);
?>