caradais Posted April 3, 2009 Share Posted April 3, 2009 Cany anyone help at all? Basically I've created a new contact.html file and a contact.php form and uploaded them to my site. But there are a couple of small glitches and I can't find where they might be. my website The email that comes through is not html even though I've said it should be (small coding error?) It comes through like this: <br><hr><br> Name: (name) <br> Tel No: 0000800 800 <br> Email: [email protected] <br> Subject: Enquiry about membership as singer <br> Message: test message <br> Voice: <br> I also don't get a "thank you for your interest" message popping up once the form is completed and cannot get the radio button to register the “voice” part when the email comes through. Link to comment https://forums.phpfreaks.com/topic/152364-php-help-with-form/ Share on other sites More sharing options...
kev wood Posted April 3, 2009 Share Posted April 3, 2009 you will need to post your code so people can look at it and tell you were you have made the small errors in your code. Link to comment https://forums.phpfreaks.com/topic/152364-php-help-with-form/#findComment-800196 Share on other sites More sharing options...
caradais Posted April 3, 2009 Author Share Posted April 3, 2009 you will need to post your code so people can look at it and tell you were you have made the small errors in your code. OK - here goes (do you need the html file as well that goes with it?) the extra bits on it are to make sure it still contains the same formatting as previous pages, but I would like a "thank you for your interest" to come up which it doesn't at the moment: ---------------------------------------------------------------------- <html> <head> <title>Contact Us</title> <style type="text/css"> <!-- .style1 {color: #FFFFFF} .style8 {font-size: x-small} a:link { color: #333333; } a:visited { color: #333333; } a:hover { color: #999999; } body { background-image: url(http://www.malmesburysingers.co.uk/images/musicback.gif); } .style37 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } .style38 { color: #800080; font-weight: bold; } .style40 {font-size: 12px} .style44 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; } --> </style> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/JavaScript"> <!-- function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_validateForm() { //v4.0 var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == ''); } //--> </script> </head> <body> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="98%" id="AutoNumber1" height="442"> <tr> <td width="100%" bgcolor="#1F68A5" style="border-style: none; border-width: medium" height="17"> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="100%" id="AutoNumber6" height="120"> <tr> <td width="52%" style="border-style: none; border-width: medium" height="118" bgcolor="#333366"> <p align="left" style="margin-left: 7; margin-top: 0; margin-bottom: 0"> <br> <strong><font color="#FFFFFF" size="6" face="Verdana">Malmesbury Singers </font></strong> <br> </td> <td width="48%" style="border-style: none; border-width: medium" height="118" bgcolor="#333366"> <p align="center" style="margin-top: 0; margin-bottom: 0"><img src="images/choir.JPG" width="214" height="118" align="right"></p> </td> </tr> </table> </td> </tr> <tr> <td width="100%" style="border:medium none #CC0000; " height="46" bgcolor="#6600CC"> <table border="1" cellpadding="0" cellspacing="0" style="border-width:0; border-collapse: collapse" bordercolor="#4D3366" width="100%" id="AutoNumber11" height="28"> <tr bgcolor="#FFFFFF"> <td width="9%" height="26" align="center" bordercolor="#333366" bgcolor="#FFFFFF" style="border-left-style: none; border-left-width: medium; border-right-style: solid; border-right-width: 1; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"> <p class="style8" style="margin-top: 2; margin-bottom: 2"> <font face="Verdana" color="#FFFFFF"><a href="http://www.malmesburysingers.co.uk/index.html">About us</a> </font></td> <td width="9%" height="26" align="center" bordercolor="#333366" bgcolor="#FFFFFF" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"> <p class="style8" style="margin-top: 2; margin-bottom: 2"><font color="#FFFFFF" face="Verdana"><a href="http://www.malmesburysingers.co.uk/history.html">History</a></font></td> <td width="9%" height="26" align="center" bordercolor="#333366" bgcolor="#FFFFFF" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"> <p class="style8" style="margin-top: 2; margin-bottom: 2"> <font face="Verdana" color="#FFFFFF"><a href="http://www.malmesburysingers.co.uk/geninfo.html">General Information</a> </font></td> <td width="9%" align="center" bordercolor="#333366" bgcolor="#FFFFFF" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"><span class="style8"><font face="Verdana" color="#FFFFFF"><a href="http://www.malmesburysingers.co.uk/currentprog.html">Current Programme</a> </font></span></td> <td width="10%" align="center" bordercolor="#333366" bgcolor="#FFFFFF" class="style8" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"><font face="Verdana" color="#FFFFFF"><a href="http://www.malmesburysingers.co.uk/forthcomprog.html">Forthcoming Programme</a> </font></td> <td width="8%" align="center" bordercolor="#333366" bgcolor="#FFFFFF" class="style8" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"><font face="Verdana" color="#FFFFFF"><a href="http://www.malmesburysingers.co.uk/pastconcerts.html">Past Concerts</a></font></td> <td width="9%" align="center" bordercolor="#333366" bgcolor="#FFFFFF" class="style8" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"><font face="Verdana" color="#FFFFFF"><a href="http://www.malmesburysingers.co.uk/hannah.html">Hannah & the Tyger </a></font></td> <td width="9%" align="center" bordercolor="#333366" bgcolor="#FFFFFF" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"><span class="style8"><font face="Verdana" color="#FFFFFF"><a href="http://www.malmesburysingers.co.uk/latest.html">Latest News</a> </font></span></td> <td width="9%" height="26" align="center" bordercolor="#333366" bgcolor="#FFFFFF" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"><p class="style8" style="margin-top: 2; margin-bottom: 2"> <font face="Verdana" color="#FFFFFF"><a href="mailto:[email protected]">Contact us </a></font></td> <td width="8%" align="center" bordercolor="#333366" bgcolor="#FFFFFF" style="border-left-style: solid; border-left-width: 1; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"><font face="Verdana" color="#FFFFFF"><font color="#FFFFFF"><a href="http://www.malmesburysingers.co.uk/legal.html" class="style8">Legal</a></font></font></td> <td width="11%" height="26" align="center" bordercolor="#333366" bgcolor="#FFFFFF" style="border-left-style: solid; border-left-width: 1; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium"> <p class="style8" style="margin-top: 2; margin-bottom: 2"> <font face="Verdana" color="#FFFFFF"><font color="#FFFFFF"><a href="http://www.malmesburysingers.co.uk/joke.html">Joke</a></font> </font></td> </tr> </table> </td> </tr> <tr> <td width="100%" style="border-left: medium none #111111; border-right: medium none #111111; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium" height="16" bgcolor="#FFCC66"> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="100%" id="AutoNumber12" height="1"> <tr> <td style="border-style: none; border-width: medium" colspan="5" height="17"> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="100%" id="AutoNumber16"> <tr> <td width="34%" style="border-style: none; border-width: medium" bgcolor="#8D68B3"> <p style="margin-left: 5"><b> </b></td> <td width="33%" style="border-style: none; border-width: medium" bgcolor="#8D68B3"> </td> <td width="33%" style="border-style: none; border-width: medium" bgcolor="#8D68B3"> <p align="right" style="margin-right: 6; margin-top: 2; margin-bottom: 2"> <font face="Verdana" size="1"><b><font color="#FFCC66">07719 478899 | Call Today</font></b></font></td> </tr> <tr> <td width="100%" style="border-style: none; border-width: medium" bgcolor="#FFFFFF" colspan="3"> <p style="margin-top: -5; margin-bottom: -5"></td> </tr> </table> </td> </tr> <tr> <td width="16%" style="border-style: none; border-width: medium" bgcolor="#FFFFFF" valign="top" height="1"> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#333366" width="107%" id="AutoNumber13" height="280"> <tr> <td width="100%" bgcolor="#4D3366" style="border-bottom:medium none #FF6600; border-left-color: #FF6600; border-left-width: 2; border-right-color: #FF6600; border-right-width: 2; border-top-color:#FF6600; " height="20"> <p style="margin: 2 3"><b> <font face="Verdana" size="2" color="#FFFFFF">Main Menu</font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF" style="border-left:1px solid #FF0000; border-right:1px solid #FF0000; border-bottom-style: none; border-bottom-width: medium; border-top-style:none; border-top-width:medium" height="25"> <p style="margin: 2 3; "><b> <font size="2" face="Arial" color="#333333"> <a href="http://www.malmesburysingers.co.uk/index.html">About Us</a> </font></b></td> </tr> <tr> <td height="25" background="http://www.malmesburysingers.co.uk/images/musicback.gif" bgcolor="#FFFFFF" style="border-left:1px solid #FF0000; border-right:1px solid #FF0000; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium; "><span style="margin: 2 3; "><b><font face="Arial" size="2" color="#333333"><a href="http://www.malmesburysingers.co.uk/history.html">History</a></font></b></span></td> </tr> <tr> <td bgcolor="#FFFFFF" style="border-left:1px solid #FF0000; border-right:1px solid #FF0000; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium; " height="25"><span style="margin: 2 3; "><b><font face="Arial" size="2" color="#333333"><a href="http://www.malmesburysingers.co.uk/geninfo.html">General Information</a></font></b></span></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF" style="border-left:1px solid #FF0000; border-right:1px solid #FF0000; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium; " height="24"> <p style="margin: 2 3; "><b><font face="Arial" size="2" color="#333333"><a href="http://www.malmesburysingers.co.uk/currentprog.html">Current Programme </a></font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF" style="border-left:1px solid #FF0000; border-right:1px solid #FF0000; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium; " height="25"> <p style="margin: 2 3; "><b><font face="Arial" size="2" color="#333333"><a href="http://www.malmesburysingers.co.uk/forthcomprog.html">Forthcoming Programme</a> </font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF" style="border-left:1px solid #FF0000; border-right:1px solid #FF0000; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium; " height="25"> <p style="margin: 2 3; "><b> <font face="Arial" size="2" color="#333333"><a href="http://www.malmesburysingers.co.uk/pastconcerts.html">Past Concerts</a></font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF" style="border-left:1px solid #FF0000; border-right:1px solid #FF0000; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium; " height="25"> <p style="margin: 2 3; "><b> <font face="Arial" size="2" color="#333333"><a href="http://www.malmesburysingers.co.uk/hannah.html">Hannah & the Tyger</a></font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF" style="border-left:1px solid #FF0000; border-right:1px solid #FF0000; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium; " height="25"> <p style="margin: 2 3; "><b> <font face="Arial" size="2" color="#333333"><a href="http://www.malmesburysingers.co.uk/latest.html">Latest News</a></font></b></td> </tr> <tr> <td width="100%" height="25" background="http://www.malmesburysingers.co.uk/images/musicback.gif" bgcolor="#FFFFFF" style="border-left:1px solid #FF0000; border-right:1px solid #FF0000; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium; "> <p style="margin: 2 3; "><b> <font size="2" face="Arial" color="#333333"><a href="mailto:[email protected]">Contact Us</a></font></b></td> </tr> <tr> <td width="100%" height="25" background="http://www.malmesburysingers.co.uk/images/musicback.gif" bgcolor="#FFFFFF" style="border-left:1px solid #FF0000; border-right:1px solid #FF0000; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium; "> <p style="margin: 2 3; "><b> <font size="2" face="Arial" color="#333333"><a href="http://www.malmesburysingers.co.uk/legal.html">Legal</a></font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF" style="border-left:1px solid #FF0000; border-right:1px solid #FF0000; border-top-style: none; border-top-width: medium; border-bottom-style:solid; border-bottom-width:1" height="25"> <p style="margin: 2 3; "><b> <font size="2" face="Arial" color="#333333"><a href="http://www.malmesburysingers.co.uk/joke.html">Choir Joke</a></font></b></td> </tr> </table> </td> <td width="2%" height="1" background="http://www.malmesburysingers.co.uk/images/musicback.gif" bgcolor="#FFFFFF" style="border-style: none; border-width: medium"> </td> <td width="56%" style="border-style: none; border-width: medium" bgcolor="#FFFFFF" valign="top" height="1"> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#C0C0C0" width="100%" id="AutoNumber14" height="198"> <tr> <td width="88%" height="19" bgcolor="#E6DDEE" valign="top" style="border-left-color: #808080; border-left-width: 2; border-right-color: #808080; border-right-width: 2; border-bottom-style: none; border-bottom-width: medium"> <p align="center" style="margin-bottom: 4"><b> <font face="Verdana" size="2" color="#333333">Contact Us </font></b></td> </tr> <tr> <td width="88%" height="177" background="http://www.malmesburysingers.co.uk/images/musicback.gif" style="border-left: 2px solid #808080; border-right: 2px solid #808080; border-top-style: none; border-top-width: medium; border-bottom-style: solid; border-bottom-width: 1"><p class="style44" style="margin-left: 9; margin-right: 3; margin-top: 8"> <script type="text/JavaScript"> <!-- <?php</p> <p> <?php /* Subject and Email Variables */ $emailSubject = 'Malmesbury Singers Contact'; $webMaster = '[email protected]'; /* Gathering Data Variables */ $yournameField = $_POST['name']; $telephoneField = $_POST['telephone']; $emailField = $_POST['email']; $selectField = $_POST['email subject']; $otherField = $_POST['general']; $messagetextField = $_POST['message']; $voicegroupField = $_POST['Voice']; $body = <<<EOD <br><hr><br> Name: $yourname <br> Tel No: $telephone <br> Email: $email <br> Subject: $select <br> Message: $messagetext <br> Voice: $yourvoice <br> EOD; $headers = "From: $email\r\n"; $headers .- "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body,$headers); /* Results rendered as HTML */ $theResults = <<<EOD <html> <head> <title>Malmesbury Singers - Enquiry</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-color: #f1f1f1; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } --> </style> </head> <div> <div align="left">Thank you for your interest! Your email will be answered very soon!</div> </div> </body> </html> EOD; echo "$theResults"; ?> <p class="style44" style="margin-left: 9; margin-right: 3; margin-top: 8"> <p class="style37"> </p> <p align="left" class="style40" style="margin-left: 9; margin-right: 3; margin-top: 8; margin-bottom: 4"> </p> <p style="margin-top: 0; margin-bottom: 0; margin-right:6" align="right"> <u><b><font face="arial,sans-serif" size="2" color="#333366">Come & Sing !</font></b></u></p> </td> </tr> </table> </td> <td width="0%" style="border-style: none; border-width: medium" bgcolor="#FFFFFF" height="1"> </td> <td width="26%" height="1" valign="top" background="http://www.malmesburysingers.co.uk/images/musicback.gif" bgcolor="#FFFFFF" style="border-style: none; border-width: medium"> <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#674589" width="100%" id="AutoNumber15" height="107"> <tr> <td width="100%" valign="top" bgcolor="#674589" height="1" style="border-bottom-style: none; border-bottom-width: medium"> <p style="margin-left: 5; margin-bottom: 4" align="center"><b> <font face="Verdana" size="2" color="#FFFFFF">Concert Feedback!</font></b></td> </tr> <tr> <td width="100%" valign="top" height="161" style="border-top-style: none; border-top-width: medium" bordercolor="#FFD2D2" bgcolor="#E6DDEE"> <p align="left" style="margin-top: 5; margin-left:4; margin-right:4"> <font face="Arial" size="2" color="#333333"><b>31/03/09</b> - Rossini's Petite Messe Solennelle - well attended and good feedback so far!</font> </td> </tr> </table> </td> </tr> <tr> <td style="border-style: none; border-width: medium" bgcolor="#FFFFFF" valign="top" height="1" colspan="5"><p class="style1" style="margin-top: -5; margin-bottom: -5"><a href="http://www.theoscommercestore.com/osCommerce-templates.htm" target="_blank"><font face=verdana,sans-serif size=1 color="#FFFFFF">osCommerce templates </font></a> </td> </tr> <tr bgcolor="#8D68B3"> <td style="border-style: none; border-width: medium" valign="top" height="3" colspan="5"> </td> </tr> <tr> <td style="border-style: none; border-width: medium" bgcolor="#FFFFFF" height="17" colspan="5"> <p align="center" class="style38" style="margin-top: 5; margin-bottom: 5"> <font face="Arial" size="1">Copyright <a href="mailto:[email protected]">K James</a>, March 2009. All Rights Reserved</font></td> </tr> </table> </td> </tr> </table> </body> </html> Link to comment https://forums.phpfreaks.com/topic/152364-php-help-with-form/#findComment-800200 Share on other sites More sharing options...
Yesideez Posted April 3, 2009 Share Posted April 3, 2009 The chunk of text that defines the message body: $body = <<<EOD <br><hr><br> Name: $yourname <br> Tel No: $telephone <br> Email: $email <br> Subject: $select <br> Message: $messagetext <br> Voice: $yourvoice <br> EOD; Change to this: $body = "\nName: $yourname\nTel No: $telephone\nEmail: $email\nSubject: $select\nMessage: $messagetext\nVoice: $yourvoice" Link to comment https://forums.phpfreaks.com/topic/152364-php-help-with-form/#findComment-800227 Share on other sites More sharing options...
Yesideez Posted April 3, 2009 Share Posted April 3, 2009 I've taken a look at the rest of the script (an email coming from "test" will be me!) and I'd check out how the "thank-you" is being displayed because you're terminating the HTML with </html> although you're displaying a LOT more after it. I'd also resize the top-right image down as you're loading a massive 2072x1026 image and displaying it at 214x118 and anyone on a slow connection will be sat there waiting for the 361KB picture to load. Scaling it down will take it to about 10KB. Link to comment https://forums.phpfreaks.com/topic/152364-php-help-with-form/#findComment-800231 Share on other sites More sharing options...
caradais Posted April 3, 2009 Author Share Posted April 3, 2009 Change to this: $body = "\nName: $yourname\nTel No: $telephone\nEmail: $email\nSubject: $select\nMessage: $messagetext\nVoice: $yourvoice" Thanks for that, although it turned out there was a "-" in a place where there should have been an "=" sign... it now works Thanks for your input Link to comment https://forums.phpfreaks.com/topic/152364-php-help-with-form/#findComment-800453 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.