Hello all~
I have been lurking here for about a month now and have been helped immesurably by your expertise. Below is a script I modified from one posted here. it works fine except for the textarea will not repopulate when submitted. The other fields do repopulate, but not that one.
Also, how does a newbie like me get the checkboxes and select boxes to repopulate as well?
<?php
//Declare the variables for mail sent back
$recipient = "info@smarthomeintegrator.com";
$subject = "Information Request Form";
$mailbody="A prospective client has the following information in the contact form:\n\n";
$mailbody.="Client Name: $fname $lname\n\n";
$mailbody.="Client Home Phone: $homephone\n\n";
$mailbody.="Client Work Phone: $workphone\n\n";
$mailbody.="Client Email: $email\n\n";
$mailbody.="Preferred Method: $method\n\n";
$mailbody.="Preferred Time: $time\n\n";
$mailbody.="Desired Services?\n=================\n$shi_av $shi_security $shi_climate $shi_com $shi_disability $shi_information\n\n";
$mailbody.="Client Comments:\n=================\n$quizzy\n\n";
$thankbody="Hello $fname,\n\n";
$thankbody.="Thank you again for visiting Smart Home Integrators. We have received your request for more information and will begin working on it immediately. \n";
$thankbody.="We will contact you in the next few business days with the answers to your questions.\n\n";
$thankbody.="Thank you once again,\n\n";
$thankbody.="Randy Stevens\n";
$thankbody.="randy.stevens@smarthomeintegrator.com\n";
$thankbody.="http://www.smarthomeintegrator.com";
//Initialize all variables
if (isset($HTTP_POST_VARS['submit'])){
$submit=$HTTP_POST_VARS['submit'];
} else $submit="";
if (isset($HTTP_POST_VARS['fname'])){
$fname=$HTTP_POST_VARS['fname'];
} else $fname="";
if (isset($HTTP_POST_VARS['lname'])){
$lname=$HTTP_POST_VARS['lname'];
} else $lname="";
if (isset($HTTP_POST_VARS['homephone'])){
$homephone=$HTTP_POST_VARS['homephone'];
} else $homephone="";
if (isset($HTTP_POST_VARS['workphone'])){
$workphone=$HTTP_POST_VARS['workphone'];
} else $workphone="";
if (isset($HTTP_POST_VARS['email'])){
$email=$HTTP_POST_VARS['email'];
} else $email="";
if (isset($HTTP_POST_VARS['quizzy'])){
$quizzy=$HTTP_POST_VARS['quizzy'];
} else $quizzy="";
/* Form already processed? */
if ($submit !=""){
$errmsg="";
/* Validation section */
if ($fname=="") $errmsg.="Please enter your first name.<br>";
if ($lname=="") $errmsg.="Please enter your last name.<br>";
if ($email=="") $errmsg.="Please enter your email address so we can reply to you<br>";
if ($quizzy=="") $errmsg.="Please enter your questions in the area provided.<br>";
/* If $errmsg is empty, validation is passed and we can send the results */
if ($errmsg==""){
mail($recipient,$subject,$mailbody,"From: $email\nX-Mailer: PHP/" . phpversion());
mail($email, "Thank You",$thankbody,"From: [email]webmaster@smarthomeintegrator.com[/email]\nX-Mailer: PHP/" . phpversion());
}
}
/* Does the form need to be displayed? */
if ($submit=="" || $errmsg!=""){
?>
<p>If you want to reach us for any reason, either use our information request form below or contact us directly. We look forward to working with you!</p>
<p align="center">Smart Home Integrators<br>123 Main Street<br>Washington, DC 20002<br>Phone: (202)412-1569<br><a href="mailto:info@smarthomeintegrator.com">info@smarthomeintegrator.com</a></p>
<?php
/* Tell the user what they missed*/
if (isset($errmsg)) echo "<font color='red' size='+1'>$errmsg</font>";
/* Now write the form */
?>
<FORM METHOD='POST' ACTION="contact.php">
<p align="center"><font size="+2">Information Request Form</font></p>
<p>Please fill out as much of this form as possible to help us in contacting you and fulfilling your requests. We respect your privacy and will never share your information with anyone.:</P>
<TABLE>
<TR>
<TD ALIGN='left'><em>Your First Name</em><font size='-1'> (Required)</font></TD>
<TD><INPUT TYPE=TEXT NAME='fname' value='<?php echo $fname; ?>' SIZE=30></TD>
</TR>
<TR>
<TD ALIGN='left'><em>Your Last Name</em><font size='-1'> (Required)</font></TD>
<TD><INPUT TYPE=TEXT NAME='lname' value='<?php echo $lname; ?>' SIZE=30></TD>
</TR>
<TR>
<TD ALIGN='left'><EM>Home Phone</EM></TD>
<TD><INPUT TYPE=TEXT NAME='homephone' value='<?php echo $homephone; ?>' SIZE=30 MAXLENGTH=20></TD>
</TR>
<TR>
<TD ALIGN='left'><EM>Work Phone</EM></TD>
<TD><INPUT TYPE=TEXT NAME='workphone' value='<?php echo $workphone; ?>' SIZE=30 MAXLENGTH=20></TD>
</TR>
<TR>
<TD ALIGN='left'><em>E-mail</em><font size='-1'> (Required)</font></TD>
<TD><INPUT TYPE=TEXT NAME='email' value='<?php echo $email; ?>' SIZE=30></TD>
</TR>
<TR>
<TD ALIGN='left'>Which of the above would be the best method of reaching you?</TD>
<TD><SELECT NAME='method' width='20'><OPTION>Home Phone<OPTION>Work Phone<OPTION SELECTED >Email</SELECT></TD>
</TR>
<TR>
<TD ALIGN='left'>What time would be best to reach you?</TD>
<TD><SELECT NAME='time'><OPTION>Evening<OPTION>Afternoon<OPTION SELECTED>Any</SELECT></TD>
</TR>
</TABLE>
<P>Which aspects of smart home technology are you most interested in? (Click all that apply)<br>
<table cellpadding='3'>
<tr>
<td width='33%'><INPUT TYPE=CHECKBOX NAME='shi_av' value='Entertainment'> Entertainment</td>
<td width='33%'><INPUT TYPE=CHECKBOX NAME='shi_security' value='Security'> Security</td>
<td width='34%'><INPUT TYPE=CHECKBOX NAME='shi_climate' value='Climate Control'> Climate Control</td>
</tr>
<tr>
<td width='33%'><INPUT TYPE=CHECKBOX NAME='shi_com' value='Communication'> Family Communication</td>
<td width='33%'><INPUT TYPE=CHECKBOX NAME='shi_disability' value='Disability'> Elderly/Disabled Care</td>
<td width='34%'><INPUT TYPE=CHECKBOX NAME='shi_information' value='General Info'> General Information</font></td>
</tr>
</table>
<P>Questions and/orcomments?<font size='-1'> (Required)</font><br>
<TEXTAREA NAME='quizzy' value='<?php echo $quizzy;?>' ROWS=5 COLS=45 wrap='soft'></TEXTAREA></P>
<INPUT TYPE=SUBMIT name='submit' VALUE='Mail It'> <INPUT TYPE=RESET VALUE='Start Over'>
</FORM>
<?php
/* Sent without an error means... */
} else {
?>
<p>Thank You!</p>
<p>Your request for information is on its way to us. You should receive a confirmation
email at the email address you provided. We will review and research your questions
and contact you with the answers as soon as possible. Thank you again for contacting
us.</p>
<p>If you would like to contact us directly, feel free to use the information below.</p>
<p align="center">Smart Home Integrators<br>123 Main Street<br>Washington, DC 20002<br>Phone: (202) 412-1569<br><a href="mailto:info@smarthomeintegrator.com">info@smarthomeintegrator.com</a></p>
<?php
}
?>
I apologize for the long post and thank you for your help.