GiGalo
04-18-2012, 12:57 PM
I am having two problems with contact since I converted my pages to template format. The first problem is the form is broken. I am able to send the mail to a static address but the email address collected on the form is not showing in the from section of the email, nor does the email show in the reply. The second issue after suibmitting the page returns to the index which is the main template that all pages resolve through. I want to simply have the form verify that a message was sent throught the existing template.
I have tried multiple things with no sucess on the email problem. Here is the original code I started with before attempts:
<?php
$message = $_GET['usr_find'];
$message .= $_GET['message'];
$reason = $_GET['reason'];
$email = $_GET['email'];
$admin = "admin email";
$bigtime = "site email";
function sendMail($reason, $email, $message, $admin, $bigtime )
{
if ($reason == "feedback")
{
mail($admin, $reason, $message, $email);
return true;
}
if ($reason == "interested")
{
mail($bigtime, $reason, $message, $email );
return true;
}
}
function showForm(){
print <<<_HTML_
<form id="contact" enctype="text/plain" method="GET" name="contact" action="$_SERVER[PHP_SELF]" onsubmit="return validateForm()">
<fieldset><legend style="color: rgb(0, 0, 0)">Please
use this form to Contact Us:</legend>
<table class="formTable">
<tbody>
<tr>
<td>Your Email Address: <input size="30" name="email" type="text"></td>
</tr>
<tr>
<td>Reason for contact:
<select name="reason">
<option selected="selected" value="not_selected">-Please select one-</option>
<option value="feedback">Site Feedback or Problems</option>
<option value="interested">interested in Service</option>
</td>
</tr>
<tr>
<td>How did you find us:
<select name="usr_find">
<option selected="selected" value="not_selected">-Please select one-</option>
<option value="friend:">Reccomended by Friend</option>
<option value="internetSearch:">Internet Search</option>
</select>
</td>
</tr>
<tr>
<td>Your Message:<br>
<textarea maxsiz="200" name="message" cols="60" rows="10" id="message"></textarea></td>
</tr>
<tr>
<td> <input name="submit" type="submit">
</td>
</tr>
</tbody>
</table>
</fieldset>
</form>
_HTML_;
}
if (isset($_GET['submit'])) {
sendMail($reason, $email, $message, $admin, $bigtime );
echo 'We have successfully recieved your mail. Thank You';
}else{
showForm();
}
?>
I have tried multiple things with no sucess on the email problem. Here is the original code I started with before attempts:
<?php
$message = $_GET['usr_find'];
$message .= $_GET['message'];
$reason = $_GET['reason'];
$email = $_GET['email'];
$admin = "admin email";
$bigtime = "site email";
function sendMail($reason, $email, $message, $admin, $bigtime )
{
if ($reason == "feedback")
{
mail($admin, $reason, $message, $email);
return true;
}
if ($reason == "interested")
{
mail($bigtime, $reason, $message, $email );
return true;
}
}
function showForm(){
print <<<_HTML_
<form id="contact" enctype="text/plain" method="GET" name="contact" action="$_SERVER[PHP_SELF]" onsubmit="return validateForm()">
<fieldset><legend style="color: rgb(0, 0, 0)">Please
use this form to Contact Us:</legend>
<table class="formTable">
<tbody>
<tr>
<td>Your Email Address: <input size="30" name="email" type="text"></td>
</tr>
<tr>
<td>Reason for contact:
<select name="reason">
<option selected="selected" value="not_selected">-Please select one-</option>
<option value="feedback">Site Feedback or Problems</option>
<option value="interested">interested in Service</option>
</td>
</tr>
<tr>
<td>How did you find us:
<select name="usr_find">
<option selected="selected" value="not_selected">-Please select one-</option>
<option value="friend:">Reccomended by Friend</option>
<option value="internetSearch:">Internet Search</option>
</select>
</td>
</tr>
<tr>
<td>Your Message:<br>
<textarea maxsiz="200" name="message" cols="60" rows="10" id="message"></textarea></td>
</tr>
<tr>
<td> <input name="submit" type="submit">
</td>
</tr>
</tbody>
</table>
</fieldset>
</form>
_HTML_;
}
if (isset($_GET['submit'])) {
sendMail($reason, $email, $message, $admin, $bigtime );
echo 'We have successfully recieved your mail. Thank You';
}else{
showForm();
}
?>