可能重复:
PHP 中的 GET URL 参数
(请注意,我对 PHP 还很陌生,还在学习)我有以下形式:
<form name="checkingEmail">
E-Mail: <input type="text" name="email1" />
<br />
Retype E-Mail: <input type="text" name="email2" />
<br />
<input type="button" value="Submit" onClick="checkEmail()">
</form>
我想从用户输入中获取值并在他们点击“提交”后执行一个简单的 If...Else 语句
PHP:
<?php
$email1 = blah //Value from email1 input form here;
$email2 = blah //Value from email2 input form here;
function checkEmail()
{
global $email1, $email2;
if($email1==$email2)
{
//Some Code Here
}
else
{
echo "Make sure your E-Mail addresses match";
}
}
?>