zarenya Posted August 21, 2010 Report Share Posted August 21, 2010 Hello All, I have created a form as seen on this website: Baby Prints UK Enquiry and now I need the form to work. In the past I used CGI Email script with results shown in a text document and the results emailed to the site owner. I have a client now that uses a different hosting company. The form is all setup but I NEED HELP getting the form submitted and sent to the site owner. I have limited knowledge regarding PHP. Can anyone advise me how to do it. PLEASE!!!!!!!!!!!!!!!!! I have asked a few close friends that know PHP and MYSQL but they are refusing to assist. Could someone please advise me to get my form working. Regards Quote Link to comment Share on other sites More sharing options...
newseed Posted August 21, 2010 Report Share Posted August 21, 2010 (edited) Google it using 'form mailer' as your search phrase: I've used this on in the past: Tectite Foxyform might be something that will work for you. You just download the basic settings and add the remainder of your fields to your form. I have asked a few close friends that know PHP and MYSQL but they are refusing to assist Refusing? If that is true then maybe those 'close friends' aren't as close as you think. Oh well, forgive them anyway! Edited August 21, 2010 by newseed Quote Link to comment Share on other sites More sharing options...
zarenya Posted August 23, 2010 Author Report Share Posted August 23, 2010 All is cool now, I was referred to a video on youtube by another friend (actually one that has been giving me problems a few years back, but we now on speaking terms again) and I made my form communicate with my very first PHP script which I coded myself. I now know the anatomy of a php script which is almost like HTML code with the advantage of /* Comments */ Lovely. Quote Link to comment Share on other sites More sharing options...
zarenya Posted August 23, 2010 Author Report Share Posted August 23, 2010 After my post above, I got the one to work but now I am struggling to fix an error on line 10 of my php file. Enquiry BP My PHP Code: <?php /* subject and email variables */ $emailSubject = 'Baby Prints General Enquiry'; $webMaster = 'zebrahim@mweb.co.za'; /* Gathing Data Variables */ $parentnameField = $_POST ['parentname']; $child1dob-X-dayField = $_POST ['child1dob-X-day']; $child2dob-X-dayField = $_POST ['child2dob-X-day']; $EmailField = $_POST ['Email']; $Address1Field = $_POST ['Address1']; $Address1Field = $_POST ['Address2']; $Address1Field = $_POST ['Address3']; $TownField = $_POST ['Town']; $CountryField = $_POST ['Country']; $PostCodeField = $_POST ['PostCode']; $TelephoneField = $_POST ['Telephone']; $CommentsField = $_POST ['Comments']; $PrivacyField = $_POST ['Privacy']; $body = <<<EOD <br><ht><br> Parent Name: $parentnameField <br> Child Particulars1: $child1dob-X-dayField <br> Child Particulars2: $child2dob-X-dayField <br> Email: $RecipientEmailField <br> Address: $Address1Field <br> Address: $Address2Field <br> Address: $Address3Field <br> Town: $TownField <br> Country: $CountryField <br> Post Code: $PostCodeField <br> Telephone: $TelephoneField <br> Comments: $CommentsField <br> Privacy: $Privacy <br> EOD; $headers = "From: $EmailField\r\n"; $headers .= "Content-type: text/html \r\n"; $success = mail ($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ -> I left out the rest of the code as its not important for now.... If you see on the HTML LINK, it asks for Child: Date of Birth and it has 3 fields, could someone help me to code that section please. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted August 23, 2010 Report Share Posted August 23, 2010 The issue is with your variable names, such as "$child1dob-X-dayField". You can't have "-" within the variable name. Variable names can include letters, numbers and underscores, so I'd replace any dashes with underscores instead. More info: http://www.php.net/manual/en/language.variables.basics.php Also, I wanted to point out this section: $Address1Field = $_POST ['Address1']; $Address1Field = $_POST ['Address2']; $Address1Field = $_POST ['Address3']; I'm assuming those should be $address1Field through $address3field? (the numbers within the variable name should change?) Quote Link to comment Share on other sites More sharing options...
zarenya Posted August 26, 2010 Author Report Share Posted August 26, 2010 I have two forms I designed in Dreamweaver and setting the action to a php script which I made using video tutorials on youtube. I received a response from my cousin, for whom I made a website. There are two forms and its getting spammed. I want to know if you able to guide or point me in the right direction to reduce the spammers from filling the form out. THE SPAMMERS EMAIL AFTER SUBMITTING THE FORM: Parent Name: kwhvnggqd Child Particulars1: 2/7/1924 Child Particulars2: 25/1/1940 Email: ltzrdl@qmbkez.com Address: 1 Address: CrTkflqqbfgdRPJMqd Address: AtqcbQZggBPNiKcRl Town: NY Post Code: 8641 Telephone: 31884100139 Comments: SNCwiP clsbxngiumoo, rahztwlyjzqw, [link=http://osjoutkbpxpm.com/]osjoutkbpxpm[/link], http://uqwqfusmneaa.com/ Privacy: THE LINKS TO THE ACTUAL FORMS IN QUESTION: http://www.babyprints.co.za/giftcard.html and http://www.babyprints.co.za/enquiry.html Could you please advise how I can reduce spam and also what security I can add to the form to make it more secure. Perhaps a captcha or something else. Awaiting your reply. Kind Regards Zarina Quote Link to comment Share on other sites More sharing options...
zarenya Posted September 22, 2010 Author Report Share Posted September 22, 2010 I need some help with form validation with my html forms which action is set to a php file. Are anyone of you able to help me. I want the results to be shown to a custom-made html page $theResults ... I firstly need help to make the fields validated to prevent spammers. Here is my php code: <?php if ($_POST['submit']) { //get form data $parentnameField = $_POST ['parentname']; $child1month = $_POST ['child1month']; $child1day = $_POST ['child1day']; $child1year = $_POST ['child1year']; $child1datevalue = "$child1day/$child1month/$child1year"; $child2month = $_POST ['child2month']; $child2day = $_POST ['child2day']; $child2year = $_POST ['child2year']; $child2datevalue = "$child2day/$child2month/$child2year"; $EmailField = $_POST ['Email']; $Address1Field = $_POST ['Address1']; $Address2Field = $_POST ['Address2']; $Address3Field = $_POST ['Address3']; $TownField = $_POST ['Town']; $PostCodeField = $_POST ['PostCode']; $TelephoneField = $_POST ['Telephone']; $CommentsField = $_POST ['Comments']; $PrivacyField = $_POST ['Privacy']; $errorstring = ""; //default value of error string if (!$parentnameField) $errorstring = $errorstring."parentname<br>"; if (!$EmailField) $errorstring = $errorstring."Email<br>"; if (!$Address1Field) $errorstring = $errorstring."Address1<br>"; if (!$Address1Field) $errorstring = $errorstring."Address1<br>"; if (!$Address2Field) $errorstring = $errorstring."Address2<br>"; if (!$Address3Field) $errorstring = $errorstring."Address3<br>"; if (!$TownField) $errorstring = $errorstring."Town<br>"; if (!$PostCodeField) $errorstring = $errorstring."PostCode<br>"; if (!$TelephoneField) $errorstring = $errorstring."Telephone<br>"; if ($errorstring!="") echo "P1ease fill out the following fields:<br>$errorstring"; else { // run code die {"$theResults"); } /* subject and email variables */ $emailSubject = 'Baby Prints General Enquiry'; $webMaster = 'zebrahim@mweb.co.za'; $body = <<<EOD <br><hr><br> Parent Name: $parentnameField <br> Child Particulars1: $child1datevalue <br> Child Particulars2: $child2datevalue <br> Email: $EmailField <br> Address: $Address1Field <br> Address: $Address2Field <br> Address: $Address3Field <br> Town: $TownField <br> Post Code: $PostCodeField <br> Telephone: $TelephoneField <br> Comments: $CommentsField <br> Privacy: $Privacy <br> EOD; $headers = "From: $EmailField\r\n"; $headers .= "Content-type: text/html \r\n"; $success = mail ($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <head> <link href="bp.css" rel="stylesheet" type="text/css"> </head> <body> <div id='main'> <table width="850" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <!--DWLayoutTable--> <tr> <td width="850" height="111" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="244" height="114" align="center" valign="top"><img src="media/images/banner_01.gif" width="237" height="111" /></td> <td width="400" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="400" height="114"> </td> </tr> </table></td> <td width="206" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="79" height="48"> </td> <td width="43" valign="top"><a href="http://www.babyprints.co.uk" target="_blank"><img src="media/images/banner_04.gif" width="43" height="48" border="0" /></a></td> <td width="42" valign="top"><img src="media/images/banner_05.gif" width="42" height="48" /></td> <td width="42" valign="top"><a href="http://www.babyprints.co.za" target="_parent"><img src="media/images/banner_06.gif" width="42" height="48" border="0" /></a></td> </tr> <tr> <td height="26" colspan="4" align="right" valign="top"><img src="media/images/banner_07.gif" width="188" height="26" /></td> </tr> <tr> <td height="40" colspan="4" valign="middle"><a href="mailto:info@babyprints.co.za"><img src="media/images/banner_05.jpg" width="206" height="36" border="0" /></a></td> </tr> </table> </td> </tr> </table></td> </tr> <tr> <td height="35" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="menupanel"> <!--DWLayoutTable--> <tr> <td width="120" height="35" align="center" valign="middle"><a href="index.html" target="_parent">Home</a></td> <td width="121" align="center" valign="middle"><a href="about.html" target="_parent">About Us </a></td> <td width="139" align="center" valign="middle"><a href="cast.html" target="_parent">Casting Options</a></td> <td width="145" align="center" valign="middle"><a href="frame.html" target="_parent">Framing Options </a></td> <td width="112" align="center" valign="middle"><a href="price.html" target="_parent">Pricing Guide</a></td> <td width="95" align="center" valign="middle"><a href="giftcard.html" target="_parent">Gift Vouchers </a></td> <td width="118" align="center" valign="middle"><a href="contactus.html" target="_parent">Contact Us </a></td> </tr> </table></td> </tr> <tr> <td height="388" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="mainpg"> <!--DWLayoutTable--> <tr> <td width="200" height="388" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="8" height="24"> </td> <td width="185"> </td> <td width="7"> </td> </tr> <tr> <td height="10" colspan="3" valign="top"><div align="center"><img src="media/top_products.gif" width="185" height="10" /></div></td> </tr> <tr> <td height="30"> </td> <td valign="top" bgcolor="#FFFFFF" class="sidebox"><p><a href="babyimprint.html" target="_parent">Baby Impressions (Framed) </a></p></td> <td> </td> </tr> <tr> <td height="30"> </td> <td valign="top" bgcolor="#FFFFFF" class="sidebox"><a href="babycast.html" target="_parent">Baby Casts (Framed)</a></td> <td> </td> </tr> <tr> <td height="30"> </td> <td valign="top" class="sidebox"><a href="foot_hand.html" target="_parent">Hand and Foot Statue Casts </a></td> <td> </td> </tr> <tr> <td height="30"> </td> <td valign="top" class="sidebox"><a href="family.html" target="_parent">Family Impressions and Casts Collection </a></td> <td> </td> </tr> <tr> <td height="10" colspan="3" valign="top"><div align="center"><img src="media/bottom_products.gif" width="185" height="10" /></div></td> </tr> <tr> <td height="226" colspan="3" valign="middle"><div align="center"> <p><a href="faq.html" target="_parent"><img src="media/button_faq.gif" width="185" height="54" border="0" /></a></p> <p><a href="enquiry.html" target="_parent"><img src="media/button_enquire.gif" width="185" height="54" border="0" /></a></p> </div></td> </tr> </table></td> <td width="650" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td height="32" colspan="3" align="center" valign="bottom"><img src="media/products_main_top.gif" width="640" height="9" /></td> </tr> <tr> <td width="5" height="33"> </td> <td width="640" valign="middle" bgcolor="#FFFFFF"><p class="subhead">Your enquiry form has been submitted </p></td> <td width="5"> </td> </tr> <tr> <td height="25"> </td> <td valign="middle" bgcolor="#FFFFFF" class="breadcrumbs">Thank you for submitting your enquiry. We will respond within 24 hours. </td> <td> </td> </tr> <tr> <td height="277"></td> <td valign="top" bgcolor="#FFFFFF" class="meantextCopy"><p> </p> </td> <td></td> </tr> <tr> <td height="23"></td> <td valign="top"><img src="media/products_main_bottom.gif" width="640" height="9" /></td> <td></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td height="45" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#CC0099" class="FOOTER"> <!--DWLayoutTable--> <tr> <td width="850" height="45" valign="middle" class="FOOTER"><div id="footer"> <div> Copyright © babyprints.co.za. All Rights Reserved. The Baby Prints logo are registered trademarks of Baby Prints (UK).</div> </div></td> </tr> </table></td> </tr> </table> </div> </body> </html> EOD; echo "$theResults"; ?> and a link to html page in question: http://www.babyprints.co.za/enquiry.html 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.
Note: Your post will require moderator approval before it will be visible.