utdfederation Posted August 24, 2008 Share Posted August 24, 2008 i was wondering if someone could share their wisdom on this script for me please as it is not working at all? i think i have messed it up big time. would appreciate any help at this point please guys n girls. the problem im having is when i upload it to the server and click on the link to launch it i get a 404 error,like i said i think i have messed it up . many thanks in advance. contact.php <?php // process the email if (array_key_exists('send', $_POST)) { $whoto = $_POST['whoto']; $sub = 'WebContact'; // list expected fields $expected = array('whoto', 'name', 'email', 'subject', 'comments', 'vercode'); // set required fields $required = array('whoto', 'name', 'email', 'subject', 'comments', 'vercode'); // create empty array for any missing fields $missing = array(); // assume that there is nothing suspect $suspect = false; // create a pattern to locate suspect phrases $pattern = '/Content-Type:|Bcc:|Cc:/i'; // function to check for suspect phrases function isSuspect($val, $pattern, &$suspect) { // if the variable is an array, loop through each element // and pass it recursively back to the same function if (is_array($val)) { foreach ($val as $item) { isSuspect($item, $pattern, $suspect); } } else { // if one of the suspect phrases is found, set Boolean to true if (preg_match($pattern, $val)) { $suspect = true; } } } // check the $_POST array and any sub-arrays for suspect content isSuspect($_POST, $pattern, $suspect); if ($suspect) { $mailSent = false; unset($missing); } else { // process the $_POST variables foreach ($_POST as $key => $value) { // assign to temporary variable and strip whitespace if not an array $temp = is_array($value) ? $value : trim($value); // if empty and required, add to $missing array if (empty($temp) && in_array($key, $required)) { array_push($missing, $key); } // otherwise, assign to a variable of the same name as $key elseif (in_array($key, $expected)) { ${$key} = $temp; } } } // validate the email address if (!empty($email)) { // regex to ensure no illegal characters in email address $checkEmail = '/^[^@]+@[^\s\r\n\'";,@%]+$/'; // reject the email address if it doesn't match if (!preg_match($checkEmail, $email)) { array_push($missing, 'email'); } } // go ahead only if not suspect and all required fields OK if (!$suspect && empty($missing)) { // build the message $msg = "Name: $name\n\n"; $msg .= "Email: $email\n\n"; $msg .= "Comments: $comments"; // limit line length to 70 characters $msg = wordwrap($msg, 70); // create additional headers $additionalHeaders = ''; if (!empty($email)) { $additionalHeaders .= "\r\nReply-To: $email"; } // send it $mailSent = mail($whoto, $sub, $msg, $additionalHeaders); if ($mailSent) { // $missing is no longer needed if the email is sent, so unset it unset($missing); } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Contact</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </script> <!-- End Preload Script --> <style type="text/css"> <!-- body { background-color: #ffffff; } .style9 { color: #f00; font-weight: bold; font-size: 85%; text-align: left; text-indent: 3px; } #name { font-family: Georgia, "Times New Roman", Times, serif; font-size: 12px; border-top-width: thin; border-right-width: thin; border-bottom-width: thin; border-left-width: thin; border-top-style: inset; border-right-style: inset; border-bottom-style: inset; border-left-style: inset; } #email { font-family: Georgia, "Times New Roman", Times, serif; font-size: 12px; border-top-width: thin; border-right-width: thin; border-bottom-width: thin; border-left-width: thin; border-top-style: inset; border-right-style: inset; border-bottom-style: inset; border-left-style: inset; } .style19 {color: #CCCCCC; font-weight: bold; font-style: italic; } #subject { font-family: Georgia, "Times New Roman", Times, serif; font-size: 12px; border-top-width: thin; border-right-width: thin; border-bottom-width: thin; border-left-width: thin; border-top-style: inset; border-right-style: inset; border-bottom-style: inset; border-left-style: inset; } #comments { font-family: Georgia, "Times New Roman", Times, serif; font-size: 12px; border-top-width: thin; border-right-width: thin; border-bottom-width: thin; border-left-width: thin; border-top-style: inset; border-right-style: inset; border-bottom-style: inset; border-left-style: inset; } .style25 {color: #f00; font-weight: bold; font-style: italic; } .style27 {color: #FF0000; font-weight: bold; font-style: italic; } #submit{ font-family: Georgia, "Times New Roman", Times, serif; font-size: 12px; font-weight: bold; width: 100px; border: thin solid #FFFFFF; font-style: italic; height: 25px; } .style29 {color: #f00; font-weight: bold; font-size: 85%; font-style: italic; } #whoto { font-size: 12px; font-weight: bold; font-family: Georgia, "Times New Roman", Times, serif; font-style: oblique; border-top-width: thin; border-right-width: thin; border-bottom-width: thin; border-left-width: thin; border-top-style: inset; border-right-style: inset; border-bottom-style: inset; border-left-style: inset; } .style34 { font-size: 85%; font-style: italic; font-weight: bold; color: #33FF00; text-align: left; text-indent: 3px; } #vercode { font-family: Georgia, "Times New Roman", Times, serif; font-size: 12px; border-top-width: thin; border-right-width: thin; border-bottom-width: thin; border-left-width: thin; border-top-style: inset; border-right-style: inset; border-bottom-style: inset; border-left-style: inset; } --> </style> </head> <body> <form name="form1" method="post" action=""> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="37%"> </td> <td width="63%"> <?php if ($_POST && isset($missing)) { ?> <span class="style9 warning"><em>Please complete the missing item(s) indicated.</em></span></td> </tr> <tr> <td> </td> <td><?php } elseif ($_POST && !$mailSent) { ?> <span class="style9 warning"><em>Sorry, there was a problem sending your message. Please try later.</em></span></td> </tr> <tr> <td> </td> <td><?php } elseif ($_POST && $mailSent) { ?> <span class="style34">Thank You. </span></td> </tr> <tr> <td> </td> <td><span class="style34">Your message has been Successfully sent.</span></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td><div align="right"></div></td> <td><?php if (isset($missing) && in_array('whoto', $missing)) { ?> <span class="warning style9"><em>Please Choose Contact !!</em></span> <?php } ?></td> </tr> <tr> <td><div align="right"><span class="style29">* </span><span class="style19">Choose Contact :</span></div></td> <td><div align="left"> <select name="whoto" size="1" id="whoto"> <option>PLEASE SELECT ADMIN !!</option> <!--------- INSERT APPROPRIATE EMAIL ADDRESS FOR EACH CONTACT ----------> <option value="your@email.com">contact1</option> <option value="your@email.com">contact2</option> <option value="your@email.com">contact3</option> <option value="your@email.com">contact4</option> <option value="your@email.com">contact5</option> </select><?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['whoto']).'"';} ?> </div></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"></div></td> <td><?php if (isset($missing) && in_array('name', $missing)) { ?> <span class="warning style9"><em>Please Enter Your name !!</em></span> <?php } ?></td> </tr> <tr> <td><div align="right"><span class="style29">* </span> <span class="style19">Your Name :</span></div></td> <td><input name="name" type="text" id="name" size="40" maxlength="90" /> <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['name']).'"';} ?></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"></div></td> <td><?php if (isset($missing) && in_array('email', $missing)) { ?> <span class="warning style9"><strong><em>Please Enter Your E-mail !!</em></strong></span> <?php } ?></td> </tr> <tr> <td><div align="right"><span class="style27">* </span> <span class="style19">Your E-mail :</span></div></td> <td><input name="email" type="text" id="email" size="40" maxlength="90" /> <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['email']).'"';} ?></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"></div></td> <td><?php if (isset($missing) && in_array('subject', $missing)) { ?> <span class="warning style9"><strong><em>Please Enter Your Subject !!</em></strong></span> <?php } ?></td> </tr> <tr> <td><div align="right"><span class="style27">*</span> <span class="style19">Your Subject :</span></div></td> <td><input name="subject" type="text" id="subject" size="40" maxlength="90" /> <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['subject']).'"';} ?></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td valign="top"><div align="right"></div></td> <td><?php if (isset($missing) && in_array('comments', $missing)) { ?> <span class="warning style9"><strong><em>Please Enter Your Message !!</em></strong></span> <?php } ?></td> </tr> <tr> <td valign="top"><div align="right"><span class="style25">*</span> <span class="style19">Your Message :</span></div> </td> <td><textarea name="comments" cols="60" rows="8" id="comments"> <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['comments']).'"';} ?></textarea></td> </tr> <tr> <td valign="top"><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"><span class="style19">Verification Code :</span></div></td> <td><img src="http://www.phpjabbers.com/contact-form/try/captcha.php" align="middle" /></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"><span class="style25">*</span> <span class="style19">Type Verification Code :</span></div></td> <td><input name="vercode" type="text" id="vercode" value="" size="10" /><?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['name']).'"';} ?> <?php if (isset($missing) && in_array('vercode', $missing)) { ?> <span class="warning style9"><strong><em>Please Enter Correct Code!!</em></strong></span> <?php } ?></td> </tr> <tr> <td><div align="right"></div></td> <td valign="middle"> </td> </tr> <tr> <td> </td> <td><input type="submit" name="submit2" id="submit" value="Send E-mail" /> <input type="hidden" name="submitted" value="TRUE" /></td> </tr> </table> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/ Share on other sites More sharing options...
MasterACE14 Posted August 24, 2008 Share Posted August 24, 2008 too much code to read.... add error_reporting(E_ALL); after the first <?php , and see if it will run in localhost, if your running it on a webhost, or vice versa. Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624228 Share on other sites More sharing options...
utdfederation Posted August 24, 2008 Author Share Posted August 24, 2008 after i input that i still get a "page cannot be displayed" error Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624239 Share on other sites More sharing options...
coder500 Posted August 24, 2008 Share Posted August 24, 2008 You forgot to close elseif ($_POST && $mailSent) {, So please close it try again, it will work. Also action attribute of form needs to be set. Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624257 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 Also action attribute of form needs to be set. No it doesnt, it will submit to self if it isnt. And 404 error , is when the page is not found , check all the links and redirects. Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624259 Share on other sites More sharing options...
utdfederation Posted August 24, 2008 Author Share Posted August 24, 2008 ok what i've done is stripped the code down so you guys can see correctly (mean no insult here) right...ok the server i have created a folder named:contact3 inside that folder i have the following: 1) contact.php (which contains) <?php include('contact3/formprocess.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Contact</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <div id="form-wrap"> <div id="form-area"> <form name="form1" method="post" action=""> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="40%"> </td> <td width="60%"> <?php if ($_POST && isset($missing)) {?> <span class="style9 warning"><em>Please complete the missing item(s) indicated.</em></span></td> </tr> <tr> <td> </td> <td><?php } elseif ($_POST && !$mailSent)) {?> <span class="style9 warning"><em>Sorry, there was a problem sending your message. Please try later.</em></span></td> </tr> <tr> <td> </td> <td><?php } elseif ($_POST && $mailSent)) {?> <span class="style34">Thank You. </span></td> </tr> <tr> <td> </td> <td><span class="style34">Your message has been Successfully sent.</span></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td><div align="right"></div></td> <td><?php if (isset($missing) && in_array('whoto', $missing)) { ?> <span class="warning style9"><em>Please Choose Contact !!</em></span> <?php } ?></td> </tr> <tr> <td><div align="right"><span class="style29">* </span><span class="style19">Choose Contact :</span></div></td> <td><div align="left"> <select name="whoto" size="1" id="whoto"> <option>PLEASE SELECT CONTACT !!</option> <!--------- INSERT APPROPRIATE EMAIL ADDRESS FOR EACH CONTACT ----------> <option value="admin@bravosquadgaming.com">contact1</option> <option value="your@email.com">contact2</option> <option value="your@email.com">contact3</option> <option value="your@email.com">contact4</option> <option value="your@email.com">contact5</option> </select><?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['whoto']).'"';} ?> </div></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"></div></td> <td><?php if (isset($missing) && in_array('name', $missing)) { ?> <span class="warning style9"><em>Please Enter Your name !!</em></span> <?php } ?></td> </tr> <tr> <td><div align="right"><span class="style29">* </span> <span class="style19">Your Name :</span></div></td> <td><input name="name" type="text" id="name" size="40" maxlength="90" /> <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['name']).'"';} ?></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"></div></td> <td><?php if (isset($missing) && in_array('email', $missing)) { ?> <span class="warning style9"><strong><em>Please Enter Your E-mail !!</em></strong></span> <?php } ?></td> </tr> <tr> <td><div align="right"><span class="style27">* </span> <span class="style19">Your E-mail :</span></div></td> <td><input name="email" type="text" id="email" size="40" maxlength="90" /> <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['email']).'"';} ?></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"></div></td> <td><?php if (isset($missing) && in_array('subject', $missing)) { ?> <span class="warning style9"><strong><em>Please Enter Your Subject !!</em></strong></span> <?php } ?></td> </tr> <tr> <td><div align="right"><span class="style27">*</span> <span class="style19">Your Subject :</span></div></td> <td><input name="subject" type="text" id="subject" size="40" maxlength="90" /> <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['subject']).'"';} ?></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td valign="top"><div align="right"></div></td> <td><?php if (isset($missing) && in_array('comments', $missing)) { ?> <span class="warning style9"><strong><em>Please Enter Your Message !!</em></strong></span> <?php } ?></td> </tr> <tr> <td valign="top"><div align="right"><span class="style25">*</span> <span class="style19">Your Message :</span></div> </td> <td><textarea name="comments" cols="60" rows="8" id="comments"> <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['comments']).'"';} ?></textarea></td> </tr> <tr> <td valign="top"><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"><span class="style19">Verification Code :</span></div></td> <td><img src="http://www.phpjabbers.com/contact-form/try/captcha.php" align="middle" /></td> </tr> <tr> <td><div align="right"></div></td> <td> </td> </tr> <tr> <td><div align="right"><span class="style25">*</span> <span class="style19">Type Verification Code :</span></div></td> <td><input name="vercode" type="text" id="vercode" value="" size="10" /><?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['name']).'"';} ?> <?php if (isset($missing) && in_array('vercode', $missing)) { ?> <span class="warning style9"><strong><em>Please Enter Correct Code!!</em></strong></span> <?php } ?></td> </tr> <tr> <td><div align="right"></div></td> <td valign="middle"> </td> </tr> <tr> <td> </td> <td><input type="submit" name="submit2" id="submit" value="Send E-mail" /> <input type="hidden" name="submitted" value="TRUE" /></td> </tr> </table> </form> </div> </div> </body> </html> 2) formprocess.php (which contains) <?php include('includes/corefuncs.php'); if (function_exists('nukeMagicQuotes')) { nukeMagicQuotes(); } // process the email if (array_key_exists('send', $_POST)) { $whoto = $_POST['whoto']; $sub = 'WebContact'; // list expected fields $expected = array('whoto', 'name', 'email', 'subject', 'comments', 'vercode'); // set required fields $required = array('whoto', 'name', 'email', 'subject', 'comments', 'vercode'); // create empty array for any missing fields $missing = array(); // assume that there is nothing suspect $suspect = false; // create a pattern to locate suspect phrases $pattern = '/Content-Type:|Bcc:|Cc:/i'; // function to check for suspect phrases function isSuspect($val, $pattern, &$suspect) { // if the variable is an array, loop through each element // and pass it recursively back to the same function if (is_array($val)) { foreach ($val as $item) { isSuspect($item, $pattern, $suspect); } } else { // if one of the suspect phrases is found, set Boolean to true if (preg_match($pattern, $val)) { $suspect = true; } } } // check the $_POST array and any sub-arrays for suspect content isSuspect($_POST, $pattern, $suspect); if ($suspect) { $mailSent = false; unset($missing); } else { // process the $_POST variables foreach ($_POST as $key => $value) { // assign to temporary variable and strip whitespace if not an array $temp = is_array($value) ? $value : trim($value); // if empty and required, add to $missing array if (empty($temp) && in_array($key, $required)) { array_push($missing, $key); } // otherwise, assign to a variable of the same name as $key elseif (in_array($key, $expected)) { ${$key} = $temp; } } } // validate the email address if (!empty($email)) { // regex to ensure no illegal characters in email address $checkEmail = '/^[^@]+@[^\s\r\n\'";,@%]+$/'; // reject the email address if it doesn't match if (!preg_match($checkEmail, $email)) { array_push($missing, 'email'); } } // go ahead only if not suspect and all required fields OK if (!$suspect && empty($missing)) { // build the message $msg = "Name: $name\n\n"; $msg .= "Email: $email\n\n"; $msg .= "Comments: $comments"; // limit line length to 70 characters $msg = wordwrap($msg, 70); // create additional headers $additionalHeaders = 'From: WebContact'; if (!empty($email)) { $additionalHeaders .= "\r\nReply-To: $email"; } // send it $mailSent = mail($whoto, $sub, $msg, $additionalHeaders); if ($mailSent) { // $missing is no longer needed if the email is sent, so unset it unset($missing); } } } ?> 3) folder named :includes inside that i have: corefuncs.php (which contains) <?php function nukeMagicQuotes() { if (get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } $_POST = array_map('stripslashes_deep', $_POST); $_GET = array_map('stripslashes_deep', $_GET); $_COOKIE = array_map('stripslashes_deep', $_COOKIE); } } ?> i did what you said (i think) but still not showing..the page just says "the page cannot be displayed" http 500 internal server error any suggestions? sorry about this guys Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624292 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 If i read it correctly , you dont have any headers, except reply to, wheres the from header? And add error_reporting(E_ALL); to the top Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624296 Share on other sites More sharing options...
utdfederation Posted August 24, 2008 Author Share Posted August 24, 2008 would this be it? // create additional headers $additionalHeaders = 'From: WebContact'; if (!empty($email)) { $additionalHeaders .= "\r\nReply-To: $email"; } Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624306 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 As i have said the email must be from an email registered on the host. this is wrong 'From: WebContact'; Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624309 Share on other sites More sharing options...
utdfederation Posted August 24, 2008 Author Share Posted August 24, 2008 ok i have itall working now and it sends mail to my email account which is fantastic guys i really do appreciate all your help on this matter i really do thank you all kindly. HOWEVER.......LOL 1 last thing still remains...which i know you will know.i've been trying to correct it for the past 2 hours now with no luck..dang. ok here goes from the screen shots below you will be able to judge it better: the first picture is when i just click on the send button. this one is after i fill out part of the form. and this is after success. here is the code in question. <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['name']).'"';} ?> one other thing when filling out the form,when i get to the message section and type something and not fill anyother part of the form out why does the text disapear from the messagebox when i click on another box to fill in? many many thanks guys for all your help so far. Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624532 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 You are echoing it in the wrong place. Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624534 Share on other sites More sharing options...
utdfederation Posted August 24, 2008 Author Share Posted August 24, 2008 magical what should i do to rectify it then please kind sir? please be assured i am not brown nosing here....alright then i am. if you can understand i have no clue when it comes to php,just going through different scripts trying to get ones head around it all. i do start classes september 15th and i can't wait to learn this,but in the meantime i do appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624538 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 how should i know , you have shown i line of code. And please start learning , we are here to help coding , not to do it for you. http://www.tizag.com/phpT/ http://www.w3schools.com/PHP/ Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624540 Share on other sites More sharing options...
utdfederation Posted August 24, 2008 Author Share Posted August 24, 2008 point taken i will be getting on it my friend as soon as i finish this. full code: <?php if ($_POST && isset($missing)) { ?> <span class="warning style2"><strong>Please complete the missing item(s) indicated.</strong></span> <p> <?php } elseif ($_POST && !$mailSent) { ?> <span class="warning style2"><strong>Sorry, there was a problem sending your message. Please try later.</strong></span> <p> <?php } elseif ($_POST && $mailSent) { ?> <span class="warning style1"><em><strong>Thank You...Your message has been Successfully sent.</strong></em></span> <p> <?php } ?> </p> <form id="feedback" method="post" action=""> <label for="whoto"><span class="style4">Choose Admin :</span> <?php if (isset($missing) && in_array('whoto', $missing)) { ?> <span class="style2 warning"><strong>Select Your Contact!!</strong></span> <?php } ?> <br> </label> <select name="whoto" size="1" id="whoto"><?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['whoto']).'"';} ?> <option></option> <option value="your@email.com">contact1</option> <option value="your@email.com">contact2</option> <option value="your@email.com">contact3</option> <option value="your@email.com">contact4</option> <option value="your@email.com">contact5</option> </select> </p> <p> <label for="name"><span class="style4">Your Name :</span> <?php if (isset($missing) && in_array('name', $missing)) { ?> <span class="warning style3">Enter Your Name!!</span> <?php } ?> <br> </label> <input name="name" id="name" type="text" class="formbox" <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['name']).'"';} ?> /> </p> <p> <label for="email"><span class="style4">Your E-mail :</span> <?php if (isset($missing) && in_array('email', $missing)) { ?> <span class="warning style3">Enter Your E-mail Address!!</span> <?php } ?> <br> </label> <input name="email" id="email" type="text" class="formbox" <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['email']).'"';} ?> /> </p> <p> <label for="subject"><span class="style4">Your Subject :</span> <?php if (isset($missing) && in_array('subject', $missing)) { ?> <span class="warning style3">Enter Your Subject!!</span> <?php } ?> <br> </label> <input name="subject" id="subject" type="text" class="formbox" <?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['subject']).'"';} ?> /> </p> <p> <label for="message"><span class="style5">Your Message :</span> <span class="style3"> <?php if (isset($missing) && in_array('message', $missing)) { ?> Enter Your Message!! <?php } ?> </span> <br> </label> <textarea name="message" id="message" cols="60" rows="8"><?php if (isset($missing)) { echo htmlentities($_POST['comments']); } ?></textarea> </p> <p> <input name="send" id="send" type="submit" value="Send E-Mail" class="button" /> </p> </form> </div> Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624547 Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 ok , first off this <select name="whoto" size="1" id="whoto"><?php if (isset($missing)) { echo 'value="'.htmlentities($_POST['whoto']).'"';} ?> <option></option> <option value="your@email.com">contact1</option> <option value="your@email.com">contact2</option> <option value="your@email.com">contact3</option> <option value="your@email.com">contact4</option> <option value="your@email.com">contact5</option> </select> wrong it should be <select name="whoto" size="1" id="whoto"> <option selected="selected" <?php if (isset($missing)) echo 'value="'.htmlentities($_POST['whoto']).'"'; ?>><?php if (isset($missing)) echo htmlentities($_POST['whoto']); ?></option> <option value="your@email.com">contact1</option> <option value="your@email.com">contact2</option> <option value="your@email.com">contact3</option> <option value="your@email.com">contact4</option> <option value="your@email.com">contact5</option> </select> The rest ,looks ok at a quick glance. Quote Link to comment https://forums.phpfreaks.com/topic/121083-require-help-on-contact-form-please/#findComment-624554 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.