<!DOCTYPE html>
<html>
<head>
<link href="aadab.css" rel="stylesheet" type="text/css">
<link rel="icon" href="images/favicon.png">
</head>
<body>
<h2>REGISTRATION FORM</h2>
<div id="form">
<?php
if(isset($_POST['submit']))
{
$name= $_POST['name'];
$phone= $_POST['phone'];
$email= $_POST['email'];
$college= $_POST['namecolg'];
$team= $_POST['team'];
$im= $_POST['im'];
$detail= $_POST['detail'];
$subject= 'Registration for aadab 2013';
if ( (empty($name)) || (empty($phone)) || (empty($email)) || (empty($college)) || (empty($detail)) )
{
echo '<p id="fillall">It is necessary that you fill at least the required fields that are marked with a star</p>';
}
else
{
$to= 'xyz@gmail.com';
$con= "<b>Registration Details:</b><br>"."Name: $name<br>"."Contact: $phone<br>"."Email: $email<br>"."College: $college<br>"."Team(if any): $team<br>"."Instant message: $im<br>"."Details of the event(s): $detail<br>";
$emsg= "Registration Details:\n\n"."Name: $name\n"."Contact: $phone\n"."Email: $email\n"."College: $college\n"."Team(if any): $team\n"."Instant message: $im\n"."Details of the event(s): $detail\n";
$msg = wordwrap($emsg,70);
$mailsend= mail($to, $subject, $msg);
if ($mailsend)
{
echo "<div class=\"regdet\"><b>Here is what you've submitted:</b><br><br>$con";
echo '<br>Congratulations! You have successfully registered! Click <a href="index.html">here</a> to continue.</div>';
}
else
{
echo '<div class="regdet"><br>OOPS! Something went wrong. Click <a href="form.php">here</a> to try again.</div>';
}
}
}
else
{?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" autocomplete="on" method="post">
<table>
<tr>
<th><label for="name">Your fullname*</label></th>
<td><input type="text" id="name" name="name" value="<?php echo $name; ?>" required></td>
</tr>
<tr>
<th><label for="phone">Your contact number*</label></th>
<td><input type="tel" id="phone" name="phone" value="<?php echo $phone; ?>" required></td>
</tr>
<tr>
<th><label for="email">Your email-id*</label></th>
<td><input type="email" id="email" name="email" value="<?php echo $email; ?>" required></td>
</tr>
<tr>
<th><label for="namecolg">Name of your college*</label></th>
<td><input type="text" id="namecolg" name="namecolg" value="<?php echo $college; ?>" required></td>
</tr>
<tr>
<th><label for="team">The name of your team<br>(if registering for a team event)</label></th>
<td><input type="text" id="team" name="team" value="<?php echo $team; ?>" ></td>
</tr>
<tr>
<th><label for="im">Bbm pin/iMessage id/Whatsapp<br>(if any, separate each id by a comma)</label></th>
<td><input type="text" id="im" name="im" value="<?php echo $im; ?>" ></td>
</tr>
<tr>
<th><label for="detail">Details of the event(s) you want to register for*</label></th>
<td><input type="text" id="detail" name="detail" value="<?php echo $detail; ?>" required></td>
</tr>
<tr><td colspan="2" style="text-align: center; padding: 40px 0px 0px 0px;"><input type="submit" name="submit" value="Register"></td</tr>
</table>
</form>
<?php } ?>
</div>
</body>
</html>
这段剧本让我困惑了两天!我找不到不允许我向我的电子邮件 ID 发送电子邮件的错误
firebug 也没有显示任何警告或错误我检查了 phpcodechecker.com 是否有可能的语法错误,但没有出现
在这两种情况下,我都无法从实时服务器和本地 zend 服务器接收邮件,我得到“else”回显语句..