我想听这个名为 submitDetails 的按钮,这是我的注册按钮。基本上我想将表单中的信息发送到 mysql 但那部分现在应该没问题我希望我的按钮可以收听电话。当被调用时,它应该收集我认为我在我的代码行中完成的所有信息,但我不确定我是否正确地完成了那部分(我使用了 isset($_GET..)而不是 $_POST ?? 认为我需要在 POST 之前获取它们 .. 还是我错了?
我还没有玩过PhP,而且我之前没有制作按钮来听电话然后采取行动,所以我不确定..我阅读的另一种方式是ajax,但它非常令人困惑,我不能让我头脑清醒,它只能通过将您发送到另一个 php 页面来工作,对吗?或者我可以让它在当前的 PhP 页面中向 mysql 发送数据吗?
这是代码行,请告诉我我的按钮如何收听电话然后放
// here you do whatever you want when button is pressed
好的,这里是代码:
<style type="text/css">
body {
background-image: url(http://i45.tinypic.com/2iw61x5.png);
background-color: #333;
}
</style>
<?php
echo "<form><font color='white'><P ALIGN='right'>• Hello guest, please <a href='loginPage.php'><font color='white'>login</font></a> / <a href='registerPage.php'><font color='white'>register</font></a>.</P></font>";
echo "<table width='850' cellpadding='1' cellspacing='1' border='0' align='center' bgcolor='#ECF7F7'>"; // starting from here
echo "<tr><td>
<u><P ALIGN='left'><b><font size='5' color='black'>Register_______________________________________________________________</font></b></P></u>
</td></tr>";
echo "</form></table>";
echo "<table width='850' cellpadding='1' cellspacing='1' border='0' align='center' bgcolor='#ECF7F7'>";
echo "<tr><td>
<TR>
<TD><b><Username: </b></TD>
<TD><input type='text' name='Username' id='Username' size='121.5' /></TD>
</TR>
</td></tr>";
echo "</table>";
echo "<table width='850' cellpadding='1' cellspacing='1' border='0' align='center' bgcolor='#ECF7F7'>";
echo "<tr><td>
<TR>
<TD><b>Password: <b></TD></P>
<TD><input type='password' name='Password' id='Password' size='122' /></TD>
</TR>
</td></tr>";
echo "</table>";
echo "<table width='850' cellpadding='1' cellspacing='1' border='0' align='center' bgcolor='#ECF7F7'>";
echo "<tr><td>
<TR>
<TD><b>Re-Password: <b></TD></P>
<TD><input type='password' name='Re-Password' id='Re-Password' size='118' /></TD>
</TR>
</td></tr>";
echo "</table>";
echo "<table width='850' cellpadding='1' cellspacing='1' border='0' align='center' bgcolor='#ECF7F7'>";
echo "<tr><td>
<TR>
<TD><b>Email: <b></TD></P>
<TD><input type='password' name='EmailAddress' id='EmailAddress' size='126' /></TD>
</TR>
</td></tr>";
echo "</table>";
echo "<form method='post'><divstyle='float:center'><P ALIGN='center'><input type='submit' id='submitDetails' name='submitDetails' value='Register'></P></div></form>";
$username = isset($_GET['Username']);
$password = isset($_GET['Password']);
$repassword = isset($_GET['Re-Password']);
$email = isset($_GET['EmailAddress']);
if(!$email == "" && (!strstr($email,"@") || !strstr($email,".")))
{
echo "<h2>Please enter valid e-mail.</h2>\n";
die ("Thank you.");
}
if(empty($username) || empty($password) || empty($repassword) || empty($email))
{
echo "<h2>Please fill in all fields, click the back button to retry</h2>\n";
die ("Thank you.");
}
$message = "Hello $username" .", We have successfuly recieved all your details and stored in our database, please proceed by logging in the website if havn't already.";
$subject = "Media Registration";
mail("hidden",$subject,$message,$email);
?>