<!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:
"."Name: $name
"."Contact: $phone
"."Email: $email
"."College: $college
"."Team(if any): $team
"."Instant message: $im
"."Details of the event(s): $detail
";
$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>
this piece of script has baffled me for two days ! i am unable to find a bug which is not allowing me to send an email to my email id
firebug also does not show any warnings or error i checked phpcodechecker.com for possible syntax errrors but nothing came up
im unable to receive maill from neither a live server nor my local zend server in both cases i get the "else" echo statement..