Create a form and send mail using loop and on page submit

<div class="box  base-mini" style="background:#E7F1F4">
<div class="head">
   <h4>Send Mail</h4>
 </div>
 <p style=" color:#24394C; font-family:Arial; font-size:10px; font-weight:bold;" align="center">If you did not find the cell phone you are looking for</p>
<form method="post" action="">
<table width="180px">
<tr>
<td style=" white-space:nowrap" >Cell:</td><td><input size="18" type="text" name="name"/></td>
</tr>
<tr>
<td style=" white-space:nowrap">Model:</td><td><input  size="18"type="text" name="number"/></td>
</tr>
<tr>
</tr>
<tr><td style=" white-space:nowrap">Email:</td><td><input  size="18"type="text" name="your"/></td>

</tr>
<tr><td align="right" colspan="2" valign="bottom"><input type="submit" name="submit" value="Send"/></td>
</tr>
</table>
</form>

<?php
if (isset($_POST['submit'])){
	if ($_REQUEST['name'] != NULL && $_REQUEST['number'] != NULL && $_REQUEST['your'] != NULL ) {
	$va1 = $_POST['name'];
	$va2 = $_POST['number'];
	$va3 = $_POST['your'];
 
 	$to = array('imran@liveoutsource.com','midpart50@gmail.com');
for($i=0;$i<=1;$i++)
{
	$to1 = $to[$i];
	$subject = "New Mobile For Your Store";
	$message ="Cell Name: " .$va1.",  "."Model: ".$va2;
	echo $to1;
	$from = $va3;
	$headers = "From: $from";
	mail($to1,$subject,$message,$headers);
}
	echo  '<p style="color:#236E2D" align="center" >'."Mail Sent".'</p>';
	}
	if ($_REQUEST['name'] == NULL || $_REQUEST['number'] == NULL || $_REQUEST['your'] == NULL ) {
	echo  '<p style="color:#FF0000" align="center" >'."Plz Enter Missing Field ".'</p>';
	 }

}
?>
</div>
Advertisements

Tagged: ,

9 thoughts on “Create a form and send mail using loop and on page submit

  1. Katty Smith April 18, 2010 at 8:01 pm

    It is extremely interesting for me to read this blog. Thanx for it. I like such topics and anything connected to this matter. I would like to read a bit more soon. By the way, pretty good design that blog has, but don’t you think design should be changed from time to time?

    Katty Smith
    shaving mug

  2. purchase cialis generic May 26, 2010 at 4:39 am

    I am the first time on this site and am really enthusiastic about and so many good articles. I think it’s just very good.
    Always yours Mr. Cialis

  3. betting football June 3, 2010 at 7:37 am

    Hey man , thanks 4 sharing but this page isn’t vewable when using IE it is showing only half the page.

  4. Cosmetic Dentist Woodland Hills July 4, 2010 at 10:41 am

    outstanding post! great advice, will take on board!

  5. petite escorts August 22, 2010 at 10:26 am

    It is very interesting for me to read the post. Thanks for it. I like such topics and anything connected to them. I definitely want to read a bit more soon.

    Julia Smith

  6. natural bodybuilding guide October 5, 2010 at 4:55 am

    I came here from one of those social bookmarking sites, this is a nice blog, keep up the good work.

  7. sukienki October 11, 2010 at 9:08 pm

    I always visit your blog and retrieve everything you post here but I never commented but today when I saw this post, I couldn’t stop myself from commenting here. Fantastic article mate!

  8. Torque Wrench November 20, 2010 at 1:17 am

    I’ve got to say that this was a solid read. I actually felt like I’ve learned something new and exciting! Thank you so much.

  9. Gz Chauhan December 21, 2011 at 6:50 pm

    Thats good work..!!!!

Comments are closed.

%d bloggers like this: