I have a PHP script through which I send HTML emails. I'm using a 'for' loop to collect data and storing it in a variable. The loop is instructed to run 25 times. The problem is that it is looping only 19 times. I checked for any unlcosed tags or typos in syntax but didn't find any. I'm posting the for loop section in case any of you can spot what I couldn't. It is really frustrating as I think the solution is very simple and yet I'm unable to spot the problem.
My headers for the 'mail()' function are fine. Here they are just in case
$headers = "From: $from \r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
And here is my for loop:
$abc ="<table width='600'>";
$abc .= "<tr>
<td bgcolor='#d6bf86'><span style='color:#9c2a00'>Number of Products</span></td>
<td align='center' bgcolor='#fde4d0'>$pagess</td>
<td align='center' bgcolor='#c3deb9'>$pagese</td>
<td align='center' bgcolor='#bee7f8'>$pagesu</td>
</tr>";
for($i=1; $i<=25; $i++)
{
$abc .="<tr>";
if($i % 2 == 0) // EVEN ROW
{
$abc .= "<td bgcolor='#d6bf86' width='260'><span style='color:#9c2a00'>".${f.$i}."</span></td>";
}
else // ODD ROW
{
$abc .= "<td bgcolor='#fffbd0' width='260'><span style='color:#9c2a00'>".${f.$i}."</span></td>";
}
if(isset(${s.$i}))
{
$abc .= "<td bgcolor='#fde4d0' align='center'>Yes</td>";
${s.$i} = "Yes";
}
else
{
$abc .= "<td bgcolor='#fde4d0' align='center'>No</td>";
${s.$i} = "No";
}
if(isset(${e.$i}))
{
$abc .= "<td bgcolor='#c3deb9' align='center'>No</td>";
${e.$i} = "Yes";
}
else
{
$abc .= "<td bgcolor='#c3deb9' align='center'>Yes</td>";
${e.$i} = "No";
}
if(isset(${u.$i}))
{
$abc .= "<td bgcolor='#bee7f8' align='center'>No</td>";
${u.$i} = "Yes";
}
else
{
$abc .= "<td bgcolor='#bee7f8' align='center'>Yes</td>";
${u.$i} = "No";
}
$abc .="</tr>";
}
if(isset($_POST['dscs'])) // DISCOUNT HAS BEEN APPLIED
{
$abc .= "<tr>
<td>Base Price</td>
<td align='center'>$sums</td>
<td align='center'>$sume</td>
<td align='center'>$sumu</td>
</tr>";
$abc .= "<tr>
<td>Discount Offered</td>
<td align='center'>$discount% </td>
<td align='center'>$discount% </td>
<td align='center'>$discount% </td>
</tr>";
$abc .= "<tr>
<td>Effective Price</td>
<td align='center'>$dscs</td>
<td align='center'>$dsce</td>
<td align='center'>$dscu</td>
</tr>";
}
else
{
$dscs = $sums;
$dsce = $sume;
$dscu = $sumu;
$abc .= "<tr>
<td>Total Price</td>
<td align='center'>$sums</td>
<td align='center'>$sume</td>
<td align='center'>$sumu</td>
</tr>";
}
$abc .="</table>";
I can attach the screenshot of the email that is being sent to give an idea on how the code is breaking. Let me know if you want the screenshot too.
PS : I copy-pasted this code in a separate file and ran it and it was working fine. The loop iterated 25 times. This makes me believe that there is a problem putting it inside HTML email.
Also adding in the email script if that helps:
$to = $clem;
$subject = "Something goes here";
$message = "<html>
<head></head>
<body style='background-color:#ffffff; font-family:Lucida Sans Unicode, Lucida Grande, sans-serif;'>
<table width='600'>
<tr>
<td>$abc</td>
</tr>
</table>
</body>
</html>";
$from = "$logged_user";
$headers = "From: $from \r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$res=mail($to,$subject,$message,$headers);
Thanks in advance,
Nisar
Nevermind, I found what was wrong. Here it is for people with similar problems.
I learnt that html emails have a 990 character limit per line. That was the reason why my code was breaking
Related
I'm having this error coming out on this script about view data script.
Please help! does i lack of " which is the last third line of the code below.
function ListUnit()
{
?>
<table class="hilite" id="highlight"><thead>
<tr><th>No.</th><th>Owner</th><th>Unit</th><th>Block</th><th>Floor</th><th>Number</th><th>Balance</th><th>Additional Info</th><th>Action</th></tr>
</thead>
<tbody>
<?php
$SQL="SELECT * FROM unit ORDER BY block, floor, unit ASC";
$result=mysql_query($SQL);
$i=1;
while ($row=mysql_fetch_assoc($result))
{
$id=$row['id'];
$ownerName=$row['ownerName'];
$ownerHP=$row['ownerHP'];
$name=$row['unitname'];
$block=$row['block'];
$floor=$row['floor'];
$unitnum=$row['unit'];
$sqft=$row['sqft'];
$resitsyabas=$row['resit_syabas'];
$ltsb=$row['LTSB'];
$ppaa=$row['PPAA'];
$b482=$row['b482'];
$tbs=$row['TBS'];
$addinfo=$row['addinfo'];
$addinfo = wordwrap($addinfo, 30, "<br>", true);
echo "<tr align=\"center\" valign=\"top\">";
echo "<td>$i</td><td align=\"left\" valign=\"top\">Name:$ownerName<br>Contact:$ownerHP</td><td>$name</td><td>$block</td><td>$floor</td><td>$unitnum</td>
<td align=\"left\">LTSB:RM$ltsb<br>PPAA:RM$ppaa<br>482:RM$b482<br>TBS:$tbs</td>
<td align=\"left\">Area:$sqft sqft<br>Meter Syabas:$resitsyabas<br>$addinfo</td><td>Edit</td>";
echo "</tr>";
$i++;
}
</tbody></table>
}
?>
so, kindly consult. how and where should i fix it?
You can not use HTML tag in a function.
You must be use
function ListUnit()
{
$html = '<table class="hilite" id="highlight"><thead>';
$html .= '<tr><th>No.</th><th>Owner</th><th>Unit</th><th>Block</th><th>Floor</th><th>Number</th><th>Balance</th><th>Additional Info</th><th>Action</th></tr>';
$html .= '</thead>';
$html .= '<tbody>';
$SQL="SELECT * FROM unit ORDER BY block, floor, unit ASC";
$result=mysql_query($SQL);
$i=1;
while ($row=mysql_fetch_assoc($result))
{
$id=$row['id'];
$ownerName=$row['ownerName'];
$ownerHP=$row['ownerHP'];
$name=$row['unitname'];
$block=$row['block'];
$floor=$row['floor'];
$unitnum=$row['unit'];
$sqft=$row['sqft'];
$resitsyabas=$row['resit_syabas'];
$ltsb=$row['LTSB'];
$ppaa=$row['PPAA'];
$b482=$row['b482'];
$tbs=$row['TBS'];
$addinfo=$row['addinfo'];
$addinfo = wordwrap($addinfo, 30, "<br>", true);
$html .= "<tr align=\"center\" valign=\"top\">";
$html .= "<td>$i</td><td align=\"left\" valign=\"top\">Name:$ownerName<br>Contact:$ownerHP</td><td>$name</td><td>$block</td><td>$floor</td><td>$unitnum</td><td align=\"left\">LTSB:RM$ltsb<br>PPAA:RM$ppaa<br>482:RM$b482<br>TBS:$tbs</td><td align=\"left\">Area:$sqft sqft<br>Meter Syabas:$resitsyabas<br>$addinfo</td><td>Edit</td>";
$html .= "</tr>";
$i++;
}
$html .= "</tbody></table>";
echo $html;
}
?>
Try replacing single quote with double while printing, something like below:
echo "<td>$i</td><td align='left' valign='top'>Name:$ownerName<br>Contact:$ownerHP</td><td>$name</td><td>$block</td><td>$floor</td><td>$unitnum</td>
<td align='left'>LTSB:RM$ltsb<br>PPAA:RM$ppaa<br>482:RM$b482<br>TBS:$tbs</td>
<td align='left'>Area:$sqft sqft<br>Meter Syabas:$resitsyabas<br>$addinfo</td><td><a href='admin_unit.php?a=1&i=$id'>Edit</a></td>";
One more point, you are missing echo before :
$html .= "</tbody></table>";
I'm working in PHP and I have a simple shopping cart which adds items when you click the add button.
Everything is collected in a variable called $cartOutput
When I echo it, it gives me everything in the cart as expected. Same with var_dump . Everything is there
However, when I try to put it in an email and send it off. It cuts off the first item. Can anyone think of why this might be?
Nothing filters it before it is put into the email. It is simply what is in the variable
here is an example...
// e.g of the php variable being assembled for each item
$cartOutput .= "<tr>";
$cartOutput .= "<td>" . $product_name . "</td>";
$cartOutput .= "<td>$" . $price . "</td>";
// emailing the variables off here
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$company = $_POST['company'];
$name = $_POST['name'];
$address = $_POST['address'];
$address2 = $_POST['address2'];
$commercialAdd = $_POST['commercial'];
$residentialAdd = $_POST['residential'];
$city = $_POST['city'];
$province = $_POST['province'];
$postal_code = $_POST['postal_code'];
$email = $_POST['email'];
$special_instructions = $_POST['special_instructions'];
$date = date("Y/m/d");
$time = date("h:i:sa");
$to = "xxx#gmail.com";
$header = "Cc:xxx#somedomain.com \r\n";
$subject = "Email Order - $company ($date - $time)";
$message = <<<EOD
<h1>Email Order - $date - $time </h1>
<h3><strong><u>Company:</u></strong> $company</h3>
<h3><strong><u>Name:</u></strong> $Name </h3>
<h3><strong><u>Address:</u></strong> $address<br>
$address2</h3>
<h3><strong><u>Residential:</u></strong> $commercialAdd </h3>
<h3><strong><u>Commercial:</u></strong> $residentialAdd </h3>
<h3><strong><u>City:</u></strong> $city</h3>
<h3><strong><u>Province:</u></strong> $province</h3>
<h3><strong><u>Postal Code:</u></strong> $postal_code</h3>
<h3><strong><u>Phone Number:</u></strong> $phone</h3>
<h3><strong><u>Email:</u></strong> $email</h3>
<h3><strong><u>Special Instructions:</u></strong> $special_instructions</h3>
<table>
<thead>
<tr>
<th>Item</th>
<th>Price</th>
<th>Weight (Kg)</th>
<th>Qty</th>
<th>Subtotal</th>
<th></th>
</tr>
</thead>
<tbody>
$cartOutput
<tr>
<td class="totals"><strong>Total</strong></td>
<td class="totals"> </td>
<td class="totals">$weightTotal kg</td>
<td class="totals">$quantityTotal</td>
<td class="totals">$ $cartTotal</td>
<td class="totals"> </td>
<tr>
</tbody>
</table>
EOD;
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html\r\n";
$retval = mail ($to,$subject,$message,$header);
if( $retval == true ) {
header("location: complete.php");
exit();
}
else {
echo "Order could not be sent. Please try again or contact our office for assistance";
}
}
Probably you are running into an email format issue. mail() requires the body to end each line in \r\n AND be less than 70 characters each. You will need to encode you HTML or include it as an attachment. See this set of instructions for an example.
I am trying to echo a for loop inside a html mail message, the loop is
for($i=0; $i<$arrlength; $i++)
{
echo $mailroom[$i] ;
if ($i<($arrlength-1) )
{
echo " & ";
}
}
It is printing the results perfectly, but it not printing any result at the html message, the html message is
$headers = "From: ". "XXXX" . "<" . $frommail . ">\r\n";
$headers .= "Reply-To: " . $frommail . "\r\n";
$headers .= "Return-path: ". $frommail;
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$sendmessage = "
<html>
<head>
<title>XXXXXX DETAILS</title>
</head>
<body>
<p>DATA FOR XXXXXXXXXX</p>
<table border=1>
<tr>
<th>Booked on</th>
<th>Name</th>
<th>Bank</th>
<th>UIN</th>
<th>Phone</th>
<th>From</th>
<th>To</th>
<th>Room No.s</th>
<th>Tariff</th>
<th>Caution Money</th>
<th>Courier</th>
<th>Bank Charges</th>
<th>Total Received</th>
</tr>
<tr>
<td>$mailtoday</td>
<td>$name (ESP)</td>
<td> </td>
<td>$uin</td>
<td>$phone</td>
<td>$mailfrom</td>
<td>$mailto</td>
<td>
**for($i=0; $i<$arrlength; $i++)
{
echo $mailroom[$i] ;
if ($i<($arrlength-1) )
{
echo " & ";
}
}**
</td>
<td>$room_total</td>
<td>$c_money</td>
<td>$courier</td>
<td>$b_charges</td>
<td>$totalreceived</td>
</tr>
</table>
</body>
</html>
";
`
Can I put the for loop inside a variable so that I can use it withing the html message or otherwise later.
You have to close off your string before attempting to use a non-string value. In this case I'd do like this:
"<td>$name (ESP)</td>
<td> </td>
<td>$uin</td>
<td>$phone</td>
<td>$mailfrom</td>
<td>$mailto</td>
<td>" . implode(' & ', $mailroom) . "</td>
<td>$room_total</td>
<td>$c_money</td>"
You cannot use a for-loop (or any other statement for that matter) in a string.
Instead you need to concatenate your string inside the loop. For example:
$myString = "test ";
for($i = 0; $i < 3; $i++) {
$myString = $myString . "$i, ";
}
$myString = $myString . " end!";
echo $myString; // shows "test 1, 2, 3, end!"
(I created this small example, as you code snippet is quite long, but the same applies)
No,You can't do this. The double quotation marks is for variable replacement. Not for code running.
Try this
$headers = "From: ". "XXXX" . "<" . $frommail . ">\r\n";
$headers .= "Reply-To: " . $frommail . "\r\n";
$headers .= "Return-path: ". $frommail;
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$sendmessage = "
<html>
<head>
<title>XXXXXX DETAILS</title>
</head>
<body>
<p>DATA FOR XXXXXXXXXX</p>
<table border=1>
<tr>
<th>Booked on</th>
<th>Name</th>
<th>Bank</th>
<th>UIN</th>
<th>Phone</th>
<th>From</th>
<th>To</th>
<th>Room No.s</th>
<th>Tariff</th>
<th>Caution Money</th>
<th>Courier</th>
<th>Bank Charges</th>
<th>Total Received</th>
</tr>
<tr>
<td>$mailtoday</td>
<td>$name (ESP)</td>
<td> </td>
<td>$uin</td>
<td>$phone</td>
<td>$mailfrom</td>
<td>$mailto</td>
<td>";
for($i=0; $i<$arrlength; $i++)
{
$sendmessage.= $mailroom[$i] ;
if ($i<($arrlength-1) )
{
$sendmessage .= "& ";
}
}
$sendmessage.=" </td>
<td>$room_total</td>
<td>$c_money</td>
<td>$courier</td>
<td>$b_charges</td>
<td>$totalreceived</td>
</tr>
</table>
</body>
</html>";
use this code, you missed php opening <?php and closing ?> tags
$sendmessage .= ".........<td>";
for($i=0; $i<$arrlength; $i++)
{
$sendmessage .= $mailroom[$i] ;
if ($i<($arrlength-1) )
{
$sendmessage .= " & ";
}
}
$sendmessage .= "</td>.........";
I need help generating form to email, i'll try many outhere but no one matched i need. I have a form i've got from Bell Online Mailer, but this script doesnt allow image to send... So i modif a little form code and now i already had an upload form. And now what kind of function or php i mustly add to display it as an image (NOT ATTACHED) corectly inside the form message..
here is the code
<?php
/*
BELLonline PHP MAILER SCRIPT v1.5
Copyright 2006 Gavin Bell
http://www.bellonline.co.uk
gavin#bellonline.co.uk
Set up an email form on your website within minutes - see readme.txt for installation.
*/
extract($_POST);
if (!file_exists("config.php"))
{
$host = $_SERVER[HTTP_HOST ];
$path = pathinfo($_SERVER['PHP_SELF']); $file_path = $path['dirname']; print "<h1>BELLonline PHP mailer script</h1> <h2>There is a problem with your PHP mailer script installation</h2> <p>The config.php file seems to be missing!</p> <p>For this script to work, you need to upload the config.php file that came with the download of the BELLonline PHP mailer script.</p> <p>The file must be in the following directory of your website:</p> <p>$host<span style=\"font-weight: bold; font-size: 150%;\">$file_path/</span></p> <p>If you need help installing the script, then feel free to email me at gavin#bellonline.co.uk</p>"; exit; } include "config.php";
if ($sendto_email == "changeme#example.com") { print "<h1>BELLonline PHP mailer script</h1> <h2>Installation nearly complete!</h2> <p>Thank you for downloading the free PHP mailer script from BELLonline web services. </p> <p>To start using the script, open config.php in a text editor and change the <b>$sendto_email</b> variable to your email address.</p> <p>If you did not get a config.php file with this script, then go to the PHP mailer script page and download the full script.</p> <p>If you need help installing the script, then feel free to email me at gavin#bellonline.co.uk</p>"; exit; } if (empty ($senders_name)) { $error = "1"; $info_error .= $lang_noname . "<br>"; } if (empty ($senders_email)) { $error
= "1"; $info_error .= $lang_noemail . "<br>"; } if (empty ($mail_subject)) { $error = "1"; $info_error .= $lang_nosubject . "<br>"; } if (empty ($mail_message)) { $error = "1"; $info_error .= $lang_nomessage . "<br>"; } if (!eregi("^[A-Z0-9._%-]+#[A-Z0-9._%-]+\.[A-Z]{2,6}$", $senders_email)) { $error = "1"; $info_error .= $lang_invalidemail . "<br>"; } if (empty ($security_code)) { $error = "1"; $info_error .= $lang_nocode . "<br>"; } elseif ($security_code != $randomness) { $error = "1"; $info_error .= $lang_wrongcode . "<br>"; } if ($showlink != "no") { $link = "<br><span style=\"font-size: 10px;\">Powered by BELLonline PHP mailer script</span>"; } if ($error == "1") { $info_notice = "<span style=\"color: " . $error_colour . "; font-weight: bold;\">" . $lang_error . "</span><br>"; if (empty ($submit)) { $info_error = ""; $info_notice = $lang_notice; }
function Random() { $chars = "ABCDEFGHJKLMNPQRSTUVWZYZ23456789"; srand((double)microtime()*1000000); $i = 0; $pass = '' ; while ($i <= 4) { $num = rand() % 32; $tmp = substr($chars, $num, 1); $pass = $pass . $tmp; $i++; } return $pass; } $random_code = Random(); $mail_message = stripslashes($mail_message);
print "<form name=\"BELLonline_email\" enctype=\"multipart/form-data\" method=\"post\" style=\"margin: 0;\" action=\"\"> <table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">
<tr align=\"$title_align\" valign=\"top\">
<td colspan=\"2\"><span style=\"$title_css\">$lang_title</span></td>
</tr>
<tr align=\"left\" valign=\"top\">
<td colspan=\"2\">$info_notice$info_error</td>
</tr>
<tr valign=\"top\">
<td align=\"right\">$lang_name</td>
<td align=\"left\"><input name=\"senders_name\" type=\"text\" class=\"mailform_input\" id=\"senders_name\" style=\"width: $input_width;\" value=\"$senders_name\" maxlength=\"32\"></td>
</tr>
<tr valign=\"top\">
<td width=\"100\" align=\"right\">$lang_youremail</td>
<td align=\"left\"><input name=\"senders_email\" type=\"text\" class=\"mailform_input\" id=\"senders_email\" style=\"width: $input_width;\" value=\"$senders_email\" maxlength=\"64\"></td>
</tr>
<tr valign=\"top\">
<td width=\"100\" align=\"right\">$lang_subject</td>
<td align=\"left\"><input name=\"mail_subject\" type=\"text\" class=\"mailform_input\" id=\"mail_subject\" style=\"width: $input_width;\" value=\"$mail_subject\" maxlength=\"64\"></td>
</tr>
<tr valign=\"top\">
<td width=\"100\" align=\"right\">$lang_message</td>
<td align=\"left\"><textarea name=\"mail_message\" cols=\"36\" rows=\"5\" style=\"width: $input_width;\" class=\"mailform_input\">$mail_message</textarea></td>
</tr>
<tr valign=\"top\">
<td width=\"100\" align=\"right\">$lang_image</td>
<td align=\"left\"><input name=\"mail_image\" size=\"10\" type=\"file\" class=\"mailform_input\" id=\"mail_image\" value=\"$mail_image\" maxlength=\"64\"></td>
</tr>
<tr align=\"left\" valign=\"top\">
<td width=\"100\">$lang_confirmation</td>
<td><input name=\"security_code\" type=\"text\" id=\"security_code\" size=\"5\">
<b>$random_code</b></td>
</tr>
<tr valign=\"top\">
<td colspan=\"2\" align=\"right\"><input name=\"randomness\" type=\"hidden\" id=\"randomness\" value=\"$random_code\">
<input name=\"submit\" type=\"submit\" id=\"submit\" value=\"$lang_submit\" class=\"mailform_button\"></td>
</tr> </table> </form>"; } else {
if ($checkdomain == "yes") { $sender_domain = substr($senders_email, (strpos($senders_email, '#')) +1); $recipient_domain = substr($sendto_email, (strpos($sendto_email, '#')) +1); if ($sender_domain == $recipient_domain) { print "Sorry, you cannot send messages from this domain ($sender_domain)"; exit; } }
$info_notice = $lang_sent; $mail_message = stripslashes($mail_message); $mail_image = $_POST['mail_image']; $content = $mail_image . $mail_message . '<p> Oleh ' . $senders_name . ', hubungi ' . $senders_email . ' </p>'; $senders_email = preg_replace("/[^a-zA-Z0-9s.#-_]/", "-", $senders_email); $from = $senders_email; $senders_name = preg_replace("/[^a-zA-Z0-9s]/", " ", $senders_name); $headers = "From: $senders_name <$senders_email> \r\n"; $headers .= "X-Mailer: BELLonline.co.uk PHP mailer \r\n"; $result = sendmail($sendto_email, $mail_subject, $content, $from);
print " <table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">
<tr align=\"$title_align\" valign=\"top\">
<td colspan=\"2\"><span style=\"$title_css\">$lang_title</span></td>
</tr>
<tr align=\"$title_align\" valign=\"top\">
<td colspan=\"2\">$info_notice</td>
</tr>
<tr valign=\"top\">
<td width=\"100\" align=\"right\">$lang_name</td>
<td align=\"left\"><b>$senders_name</b></td>
</tr>
<tr valign=\"top\">
<td width=\"100\" align=\"right\">$lang_youremail</td>
<td align=\"left\"><b>$senders_email</b></td>
</tr>
<tr valign=\"top\">
<td width=\"100\" align=\"right\">$lang_subject</td>
<td align=\"left\"><b>$mail_subject</b></td>
</tr>
<tr valign=\"top\">
<td width=\"100\" align=\"right\">$lang_message</td>
<td align=\"left\"><b>$mail_message</b></td>
</tr>
</table>";
}
//Simple mail function with HTML header
function sendmail($sendto_email, $mail_subject, $content, $from) {
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
$result = mail($sendto_email, $mail_subject, $content, $headers);
if ($result) return 1;
else return 0;
}
?>
You can easily solve it using PHP upload or an image uploader (I'm using Plupload at the moment) and PHP Mailer to send the email. As you mentioned not to intend sending the image as an attachment, in PHP Mailer, you just have to set an html message with the image inside it.
Lately, I've made changes on my javascript code, just a simple contact form and also using colorbox plugin too. It's up and running for 5 days. For the first 2 days I received emails from the form after that I've made changes on the code that causes not to received the forms data from user. Since then, I didn't receive any emails. Is there a way to still retrieve and recover the data send from the form?
if (isset($_POST['register-form'])) {
$_POST = array_map('htmlentities', $_POST);
if ($_POST['type'] == '1') {
$status = "Professional";
}
if ($_POST['type'] == '2') {
$status = "Student";
}
/** Make the mail **/
$headers = "from: noreply#sample.com\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$subject = "Registration";
$mail = "<table border='0' width='100%' cellpadding='5' cellspacing='1'>
<tr>
<td witdth='15%'><strong>First Name</strong></td>
<td>{$_POST['first-name']}</td>
</tr>
<tr>
<td><strong>Last Name</strong></td>
<td>{$_POST['last-name']}</td>
</tr>
<tr>
<td><strong>Contact Number</strong></td>
<td>{$_POST['contact-number']}</td>
</tr>
<tr>
<td><strong>E-mail</strong></td>
<td>{$_POST['email']}</td>
</tr>
<tr>
<td><strong>Level</strong></td>
<td>{$status}</td>
</tr>
<tr>
<td><strong>Company/School</strong></td>
<td>{$_POST['company-name']}</td>
</tr>
</table>";
mail('sample91#gmail.com', $subject, $mail, $headers);
}