vince.clark Posted October 18, 2007 Share Posted October 18, 2007 I have been attempting to install a form (matts archive) however, the server will not accept the cgi script. So I tried my hand at a free php script. I am no where near proficient with php, actually this is my first time attempting to utilize it. Below you will find the 2 files required to make the form work. Once I have uploaded the form, it tells me that all required areas need to be filled out even though they are. I'm about to pull what little hair I have left out. Please help: Here is the form link: www.liviewater.com/form_pop.php E-mail Form Code (contact.php) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Email Form </title> </head> <body> <form method="post" action="sendeail.php"> <!-- DO NOT change ANY of the php sections --> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input type="hidden" name="ip" value="<?php echo $ipi ?>" /> <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" /> <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" /> Your Name: <br /> <input type="text" name="visitor" size="35" /> <br /> Your Email:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> <br /> Attention:<br /> <select name="attn" size="1"> <option value=" Sales n Billing ">Sales n Billing </option> <option value=" General Support ">General Support </option> <option value=" Technical Support ">Technical Support </option> <option value=" Webmaster ">Webmaster </option> </select> <br /><br /> Mail Message: <br /> <textarea name="notes" rows="4" cols="40"></textarea> <br /> <input type="submit" value="Send Mail" /> <br /> Free Code at: <a href="http://www.ibdhost.com/contact/">ibdhost.com/contact/</a> </form> </body> </html> Code for sendeail.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sendemail Script</title> </head> <body> <!-- Reminder: Add the link for the 'next page' (at the bottom) --> <!-- Reminder: Change 'YourEmail' to Your real email --> <?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $visitor = $_POST['visitor']; $visitormail = $_POST['visitormail']; $notes = $_POST['notes']; $attn = $_POST['attn']; if (eregi('http:', $notes)) { die ("Do NOT try that! ! "); } if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) { echo "<h2>Use Back - Enter valid e-mail</h2>\n"; $badinput = "<h2>Feedback was NOT submitted</h2>\n"; echo $badinput; die ("Go back! ! "); } if(empty($visitor) || empty($visitormail) || empty($notes )) { echo "<h2>Use Back - fill in all fields</h2>\n"; die ("Use back! ! "); } $todayis = date("l, F j, Y, g:i a") ; $attn = $attn ; $subject = $attn; $notes = stripcslashes($notes); $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n "; $from = "From: $visitormail\r\n"; mail("YourEmail", $subject, $message, $from); ?> <p align="center"> Date: <?php echo $todayis ?> <br /> Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) <br /> Attention: <?php echo $attn ?> <br /> Message:<br /> <?php $notesout = str_replace("\r", "<br/>", $notes); echo $notesout; ?> <br /> <?php echo $ip ?> <br /><br /> <a href="contact.php"> Next Page </a> </p> </body> </html> (edited by kenrbnsn to put in tags) Quote Link to comment https://forums.phpfreaks.com/topic/73859-solved-im-lostphp-form/ Share on other sites More sharing options...
Daukan Posted October 18, 2007 Share Posted October 18, 2007 I just tried this on my server and it worked fine. Are you filling out the form before submitting? Quote Link to comment https://forums.phpfreaks.com/topic/73859-solved-im-lostphp-form/#findComment-372742 Share on other sites More sharing options...
vince.clark Posted October 19, 2007 Author Share Posted October 19, 2007 Thank you, I figured it out. I did not set the required fields properly. I guess in my mad rush to update, I was not paying much attention to a minor detail. I apologize for taking up your time. Quote Link to comment https://forums.phpfreaks.com/topic/73859-solved-im-lostphp-form/#findComment-373122 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.