poleman Posted November 28, 2007 Share Posted November 28, 2007 Hi there, Am trying to get this form to work but getting puzzled... what is going wrong? I want it to send the form's contents by email to a specified email address. It is redirecting via another url as the home url's server does not support php. <form> <form action="http://www.feniaaly.com/contact.php" method="post"> <table border="0" cellpadding="8" cellspacing="8" summary="feedback form"> <tr><td width="100"><span lang="en-gb"><font face="Verdana" size="2">Name:</font></span></td> <td width="226"><input type="text" name="name" size="25" /></td></tr> <tr> <td><span lang="en-gb"><font face="Verdana" size="2">Email Address:</font></span></td> <td><input type="text" name="email" size="25" /></td> </tr> <tr> <td><span lang="en-gb"><font face="Verdana" size="2">Telephone:</font></span></td><td><input type="text" name="email" size="25" /></td></tr> <tr> <td colspan="2"> <span lang="en-gb"><font face="Verdana" size="2">Query:</font></span><br /> <textarea rows="15" cols="45" name="comments"></textarea></td> </tr> <tr> <td align="center" colspan="2"> <input type="submit" value="Send Query" /></td> </tr> </table> </form> Thanks Richard Quote Link to comment Share on other sites More sharing options...
burnside Posted November 28, 2007 Share Posted November 28, 2007 you need to include the other file as well. that is just a html file. Quote Link to comment Share on other sites More sharing options...
revraz Posted November 28, 2007 Share Posted November 28, 2007 Thats just the HTML, hard to say without seeing the .php too. Quote Link to comment Share on other sites More sharing options...
poleman Posted November 28, 2007 Author Share Posted November 28, 2007 Sure, here you go... <?PHP ###################################################### # # # Forms To Go 3.1.1 # # http://www.bebosoft.com/ # # # ###################################################### ###################################################### # # # UNREGISTERED VERSION # # # ###################################################### DEFINE('kOptional', True); DEFINE('kMandatory', False); error_reporting(E_ERROR | E_WARNING | E_PARSE); ini_set('track_errors', true); function DoStripSlashes($FieldValue) { if ( get_magic_quotes_gpc() ) { if (is_array($FieldValue) ) { return array_map('DoStripSlashes', $FieldValue); } else { return stripslashes($FieldValue); } } else { return $FieldValue; } } #---------- # FilterCChars: function FilterCChars($TheString) { return preg_replace('/[\x00-\x1F]/', '', $TheString); } #---------- # Validate: Email function check_email($email, $optional) { if ( (strlen($email) == 0) && ($optional === true) ) { return true; } elseif ( eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email) ) { return true; } else { return false; } } if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ClientIP = $_SERVER['REMOTE_ADDR']; } $FTGname = DoStripSlashes( $_REQUEST['Name'] ); $FTGtel = DoStripSlashes( $_REQUEST['Email Address'] ); $FTGemail = DoStripSlashes( $_REQUEST['Telephone'] ); $FTGmessage = DoStripSlashes( $_REQUEST['Query'] ); # Fields Validations $ValidationFailed = false; if (!check_email($FTGemail, kMandatory)) { $ValidationFailed = true; } # Include message in error page and dump it to the browser if ($ValidationFailed === true) { $ErrorPage = '<html><head><title>Error</title></head><body>'; $ErrorPage .= 'Errors found: <!--VALIDATIONERROR-->'; $ErrorPage .= '</body></html>'; $ErrorPage = str_replace('<!--VALIDATIONERROR-->', $ErrorList, $ErrorPage); $ErrorPage = str_replace('<!--FIELDVALUE:name-->', $FTGname, $ErrorPage); $ErrorPage = str_replace('<!--FIELDVALUE:tel-->', $FTGtel, $ErrorPage); $ErrorPage = str_replace('<!--FIELDVALUE:email-->', $FTGemail, $ErrorPage); $ErrorPage = str_replace('<!--FIELDVALUE:message-->', $FTGmessage, $ErrorPage); echo $ErrorPage; exit; } # Email to Form Owner $emailSubject = FilterCChars("Enquiry from ITS Website"); $emailBody = "FAO: ITS" . "\n" . "\n" . "Name : $FTGName\n" . "Tel : $FTGEmail Address\n" . "Email : $FTGTelephone\n" . "Message : $FTGQuery\n" . "\n" . "Thanks\n" . "\n" . "$FTGName\n" . ""; $emailTo = "<all@itstravel.co.uk>"; $emailFrom = FilterCChars("$FTGName"); $emailHeader = "From: $emailFrom\n" . "Cc: <claytondavid@ntlworld.com>" . "\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"ISO-8859-1\"\n" . "Content-transfer-encoding: 8bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Redirect user to success page header("Location: http://www.itstravel.co.uk/thankyou.html"); exit; ?> Quote Link to comment Share on other sites More sharing options...
poleman Posted November 28, 2007 Author Share Posted November 28, 2007 can anyone help with this? ??? Quote Link to comment Share on other sites More sharing options...
revraz Posted November 28, 2007 Share Posted November 28, 2007 Give people more than 10-15 mins to review it. can anyone help with this? ??? Quote Link to comment Share on other sites More sharing options...
poleman Posted November 28, 2007 Author Share Posted November 28, 2007 ok, hope to hear from someone soon... thanks for your help.... Quote Link to comment Share on other sites More sharing options...
poleman Posted November 28, 2007 Author Share Posted November 28, 2007 any ideas on this? Quote Link to comment Share on other sites More sharing options...
poleman Posted November 28, 2007 Author Share Posted November 28, 2007 can no one help with this? ??? Quote Link to comment Share on other sites More sharing options...
razzle Posted November 28, 2007 Share Posted November 28, 2007 mate i found an email form thing that worked here i suggest you just use this, its basic but it works http://www.thesitewizard.com/wizards/feedbackform.shtml Quote Link to comment Share on other sites More sharing options...
poleman Posted November 28, 2007 Author Share Posted November 28, 2007 thanks... this is a good site and programme but I'm still having problems. The contact.htm page simply refreshes instead of going to the thankyou page. Here is the url that gets displayed after submitting the form: http://www.itstravel.co.uk/contact.htm?name=test&email=test&email=test&comments=test here are the two scripts. Hope you can help... HTML - the form is sent to usip.co.uk where the php code is hosted as the its.co.uk server does not support php. <form> <form action="http://www.usip.co.uk/feedback.php" method="post"> <table border="0" cellpadding="8" cellspacing="8" summary="feedback form"> <tr><td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Name:</font></td><td><input type="text" name="name" size="25" /></td></tr> <tr> <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email address:</font></td> <td><input type="text" name="email" size="25" /></td> </tr> <tr> <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Telephone:</font></td><td><input type="text" name="email" size="25" /></td></tr> <tr> <td colspan="2"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">Message</font>:<br /> <textarea rows="15" cols="45" name="comments"></textarea></td> </tr> <tr> <td align="center" colspan="2"> <input type="submit" value="Send Query" /><br /></td> </tr> </table> </form> Here is the PHP code: <?php /* CHFEEDBACK.PHP Feedback Form PHP Script Ver 2.08 Generated by thesitewizard.com's Feedback Form Wizard. Copyright 2000-2007 by Christopher Heng. All rights reserved. thesitewizard and thefreecountry are trademarks of Christopher Heng. Get the latest version, free, from: http://www.thesitewizard.com/wizards/feedbackform.shtml You can read the Frequently Asked Questions (FAQ) at: http://www.thesitewizard.com/wizards/faq.shtml I can be contacted at: http://www.thesitewizard.com/feedback.php Note that I do not normally respond to questions that have already been answered in the FAQ, so *please* read the FAQ. LICENCE TERMS 1. You may use this script on your website, with or without modifications, free of charge. 2. You may NOT distribute or republish this script, whether modified or not. The script can only be distributed by the author, Christopher Heng. 3. THE SCRIPT AND ITS DOCUMENTATION ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, NOT EVEN THE IMPLIED WARRANTY OF MECHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. YOU AGREE TO BEAR ALL RISKS AND LIABILITIES ARISING FROM THE USE OF THE SCRIPT, ITS DOCUMENTATION AND THE INFORMATION PROVIDED BY THE SCRIPTS AND THE DOCUMENTATION. If you cannot agree to any of the above conditions, you may not use the script. Although it is not required, I would be most grateful if you could also link to thesitewizard.com at: http://www.thesitewizard.com/ */ // ------------- CONFIGURABLE SECTION ------------------------ // $mailto - set to the email address you want the form // sent to, eg //$mailto = "youremailaddress@example.com" ; $mailto = 'all@itstravel.co.uk' ; // $subject - set to the Subject line of the email, eg //$subject = "Feedback Form" ; $subject = "Query from ITS Website" ; // the pages to be displayed, eg //$formurl = "http://www.example.com/feedback.html" ; //$errorurl = "http://www.example.com/error.html" ; //$thankyouurl = "http://www.example.com/thankyou.html" ; $formurl = "http://www.itstravel.co.uk/contact.htm" ; $errorurl = "http://www.itstravel.co.uk/contactfailed.htm" ; $thankyouurl = "http://www.itstravel.co.uk/thankyou.htm" ; $uself = 0; // -------------------- END OF CONFIGURABLE SECTION --------------- $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $name = $_POST['name'] ; $email = $_POST['email'] ; $comments = $_POST['comments'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (empty($name) || empty($email) || empty($comments)) { header( "Location: $errorurl" ); exit ; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name of sender: $name\n" . "Email of sender: $email\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.08" ); header( "Location: $thankyouurl" ); exit ; ?> Quote Link to comment Share on other sites More sharing options...
poleman Posted November 29, 2007 Author Share Posted November 29, 2007 can anyone see why this is still not working for me? Thanks. Quote Link to comment Share on other sites More sharing options...
burnside Posted November 30, 2007 Share Posted November 30, 2007 i think you sould go back to basics visit www.php.net the script is abit to advanced if you dont understand the basics. Quote Link to comment Share on other sites More sharing options...
aschk Posted November 30, 2007 Share Posted November 30, 2007 Basically your input fields (in the html file) don't match those that your PHP file is trying to utilise. What error/problem are you getting? This will help us establish more easily where you need to debug. Quote Link to comment Share on other sites More sharing options...
poleman Posted November 30, 2007 Author Share Posted November 30, 2007 thanks.... well, I don't get any error message. When hitting the submit button it just clears the form and displays the text entered inthe url bar - like this: http://www.itstravel.co.uk/contact.htm?name=test&email=test&email=test&comments=test How and where should the PHP file be changed to reflect the HTML form? thanks... Quote Link to comment 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.