LMHart
04-15-2009, 10:43 AM
I have been trying to get the mail() function to work. I understand that it can only take on a max of 5 conditions. However I am stuck on getting the required info into the $message. What i would like is all the info from my page to be email to me.
Here is the code from my form
<html>
<body>
<strong>Contact Us or Request a Quote</strong>
<p>Please complete the form below and ensure that all information is accurate. </p>
<form action="form_email.php" method="post">
<p>Your Name: <span class="required">*</span><br /><input type="text" id="name" name="name" size="50" maxlength="80" /></p>
<p>Your Email: <span class="required">*</span><br /><input type="text" id="email" name="email" size="50" maxlength="80" /></p>
<p>Your Current Web Address (if applicable): <br /><input type="text" id="address" name="address" size="50" maxlength="80" /></p>
<p>Expected project budget: <br /><select name="budget" id="budget">
<option value="$500-$1200">$500 - $1200</option>
<option value="$1201-$2500">$1201-$2500</option>
<option value="$2501-$5000" selected>$2501-$5000</option>
<option value="$5001-$10,000">$5000-$10,000</option>
<option value="$10,001 - $25,000">$10,001-$25,000</option>
<option value="more than $25k">More than $25,000</option>
</select></p>
<p>Comments/Questions: <span class="required">*</span><br /><textarea cols="50" id="comments" rows="5" name="comments"></textarea></p>
<p><input type="submit" value="submit" /> </p>
<p>Items marked with a <span class="required">*</span> are required</p>
</form>
<p> </p>
</body>
</html>
and here is my script to email
<html>
<body>
<?php
if (isset($_REQUEST['form_email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = "Information Request from Website";
$name = $_REQUEST['name'];
$contact = $_REQUEST['email'];
$address = $_REQUEST['address'];
$budget = $_REQUEST['budget'];
$comments = $_REQUEST['comments'];
$message = array('name','email', 'address','budget','comments');
mail( "info@mainstreetwebsolutions.com", "Subject: $subject",
$message, "From: $email");
echo "Thank you for using our mail form";
}
/*else
//if "email" is not filled out, display the form
// {
echo "<form method='post' action='mailform.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}*/
?>
Here is the code from my form
<html>
<body>
<strong>Contact Us or Request a Quote</strong>
<p>Please complete the form below and ensure that all information is accurate. </p>
<form action="form_email.php" method="post">
<p>Your Name: <span class="required">*</span><br /><input type="text" id="name" name="name" size="50" maxlength="80" /></p>
<p>Your Email: <span class="required">*</span><br /><input type="text" id="email" name="email" size="50" maxlength="80" /></p>
<p>Your Current Web Address (if applicable): <br /><input type="text" id="address" name="address" size="50" maxlength="80" /></p>
<p>Expected project budget: <br /><select name="budget" id="budget">
<option value="$500-$1200">$500 - $1200</option>
<option value="$1201-$2500">$1201-$2500</option>
<option value="$2501-$5000" selected>$2501-$5000</option>
<option value="$5001-$10,000">$5000-$10,000</option>
<option value="$10,001 - $25,000">$10,001-$25,000</option>
<option value="more than $25k">More than $25,000</option>
</select></p>
<p>Comments/Questions: <span class="required">*</span><br /><textarea cols="50" id="comments" rows="5" name="comments"></textarea></p>
<p><input type="submit" value="submit" /> </p>
<p>Items marked with a <span class="required">*</span> are required</p>
</form>
<p> </p>
</body>
</html>
and here is my script to email
<html>
<body>
<?php
if (isset($_REQUEST['form_email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = "Information Request from Website";
$name = $_REQUEST['name'];
$contact = $_REQUEST['email'];
$address = $_REQUEST['address'];
$budget = $_REQUEST['budget'];
$comments = $_REQUEST['comments'];
$message = array('name','email', 'address','budget','comments');
mail( "info@mainstreetwebsolutions.com", "Subject: $subject",
$message, "From: $email");
echo "Thank you for using our mail form";
}
/*else
//if "email" is not filled out, display the form
// {
echo "<form method='post' action='mailform.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}*/
?>
