svenjcvd Posted February 10, 2011 Share Posted February 10, 2011 Im having some problems with my PHP program... Im trying to get the imformation send to my inbox, but when i push the submit button; i get no email and the "thank you message" is incomplete.. (see attachement: thankUmessage.png) I have to say, im not really a PHPfreak , I understand this language a little.. I hope someone can help me first the codes: HTML: (see attachement: form.png) <!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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>contactformulier</title> <style type="text/css"> <!-- body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #FFFF00; } body { background-color: #CCCCCC; } .style2 {font-size: 16px} --> </style> <script type="text/javascript"> <!-- function MM_validateForm() { //v4.0 if (document.getElementById){ 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=document.getElementById(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> <form id="form1" name="form1" method="post" action="contactafhandeling.php"> <table width="400" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC" bgcolor="#000000"> <!--DWLayoutTable--> <tr> <td height="39" colspan="6"><div align="center" class="style2">Contact formulier<br /> </div></td> </tr> <tr> <td height="21"><div align="right">Aanhef:</div></td> <td width="4" rowspan="7"> </td> <td colspan="4" valign="top"> <select name="aanhef" id="aanhef"> <option value="dhr" selected="selected">Dhr.</option> <option value="mvr">Mvr.</option> </select> </td> </tr> <tr> <td width="72" height="20"><div align="right">Voorletters:</div></td> <td width="42" valign="top"><div align="left"> <input name="voorletters" type="text" id="voorletters" size="5" maxlength="40" /> </div></td> <td width="120" valign="top"><div align="center">Achternaam: </div></td> <td colspan="2" valign="top"><div align="left"> <input name="achternaam" type="text" id="achternaam" size="20" maxlength="40" /> </div> <div align="left"></div> </td> </tr> <tr> <td height="20"><div align="right">Adres:</div></td> <td colspan="2" valign="top"><div align="left"> <input name="adres" type="text" id="adres" size="20" maxlength="40" /> </div> <div align="center"></div> <div align="left"></div></td> <td width="79" valign="top"><div align="center">Postcode:</div></td> <td valign="top"><div align="right"> <input name="postcode" type="text" id="postcode" size="10" maxlength="7" /> </div></td> </tr> <tr> <td height="20"><div align="right">Woonplaats:</div></td> <td colspan="4" align="right" valign="top"><div align="left"> <input name="woonplaats" type="text" id="woonplaats" size="20" maxlength="40" /> </div> <div align="left"></div> <div align="left"></div> <div align="left"></div></td> </tr> <tr> <td height="20"><div align="right">Tel:</div></td> <td colspan="4" valign="top"><div align="left"> <input name="tel" type="text" id="tel" size="20" maxlength="10" /> </div></td> </tr> <tr> <td height="20"><div align="right">Email:</div></td> <td colspan="4" valign="top"> <div align="left"> <input name="email" type="text" id="email" size="40" maxlength="40" /> </div></td> </tr> <tr> <td height="20"><div align="right">Interesses:</div></td> <td colspan="4" valign="top"><div align="left"> <label></label> <label> <input type="checkbox" name="badkamer" id="badkamer" /> Badkamermeubels</label> <label> <br /> <input type="checkbox" name="kantoor" id="kantoor" /> Kantoormeubels</label> <label> <br /> <input type="checkbox" name="kasten" id="kasten" /> Kasten</label> <label><br /> <input type="checkbox" name="keukens" id="keukens" /> Keukens <br /> </label> <label> <input type="checkbox" name="tafels" id="tafels" /> Tafels</label> <br /> </div></td> </tr> <tr> <td height="21" colspan="5" valign="top"><input type="reset" name="reset" id="reset" value="Reset" /></td> <td width="83" height="21" valign="top"><input name="verzenden" type="submit" id="verzenden" onclick="MM_validateForm('voorletters','','R','achternaam','','R','tel','','RisNum','email','','RisEmail');return document.MM_returnValue" value="Verzenden" /></td> </tr> </table> </form> </body> </html> Looks like: afbeelding 1.png Then the PHP code: <!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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Contactafhandeling</title> </head><body> <? $aanhef = $_POST['aanhef']['dhr']; $aanhef = $_POST['aanhef']['mvr']; $voorletters = $_POST['voorletters']; $achterNaam = $_POST['achterNaam']; $adres = $_POST['adres']; $postcode = $_POST['postcode']; $tel = $_POST['tel']; $email = $_POST[email]; $interesses = $_POST['badkamer']['kantoor']['kasten']['keukens']['tafels']; $formsent = mail('[email protected]', 'Gegevens afkomstig van contactformulier.html', "Naam: $aanhef $voorletters $achterNaam\r\n Adres: $adres\r\n Postcode: $plaatst\r\n Telefoonnummer: $tel\r\n Emailadres: $email\r\n Interesse in: $interesses", "From: $email\r\nBounce-to: [email protected]"); if ($formsent) { echo "<p>Beste $achternaam,<br><br> Bedankt voor uw bericht, we zullen zo snel mogelijk contact met u opnemen.\n\r Met vriendelijke groet, JPS</p>"; } else { echo "<p>Sorry, er gaat iets fout met het formulier, probeer het later nog eens a.u.b.</p>"; } ?> </body> </html> [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/ Share on other sites More sharing options...
svenjcvd Posted February 10, 2011 Author Share Posted February 10, 2011 Is there anybody who can help me out here? Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172432 Share on other sites More sharing options...
BlueSkyIS Posted February 10, 2011 Share Posted February 10, 2011 i think you need to start with some basic tutorials that show you how to get information from form fields, specifically from select's. http://www.tizag.com/phpT/forms.php and if you aren't seeing any notices or warnings when you run your code (as you should be seeing), you should add this at the top of the PHP: error_reporting(E_ALL); ini_set("display_errors", -1); Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172462 Share on other sites More sharing options...
svenjcvd Posted February 10, 2011 Author Share Posted February 10, 2011 Thanks for your help, i know there are some missing codes in this script, but i don't got enough time to go back to school If i succeed understanding PHP (to make this script working), i will loose so much time, that even this site will be offline... I really need this form working, Its for my dad's website, which needed to be launched be4 april 1th.. not enough time to learn a language i think... So please..who can help me making this code work? Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172492 Share on other sites More sharing options...
Pikachu2000 Posted February 10, 2011 Share Posted February 10, 2011 So you want someone to just fix it and give it back to you, debugged, tested and working? Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172497 Share on other sites More sharing options...
svenjcvd Posted February 10, 2011 Author Share Posted February 10, 2011 Ok.. I ve been working all day long trying to make these codes work.. and... you re not helping dude.. if you don't want to help me it's oke...no problems, just go read someone else's questions. maybe you CAN help them.. I't not that i don't understand anything.. I understand HTML, so im not asking you to make my website ...No im asking someone who DO wants to help me out here... maybe it's not so hard for you to fix, for me it is... Maybe what im trying to do is all wrong.. maybe its not even a language.. Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172521 Share on other sites More sharing options...
Pikachu2000 Posted February 10, 2011 Share Posted February 10, 2011 You've already said you don't want/have time to learn PHP, so the reasonable assumption it that you want someone to write the code for you, and if that is the case, you need to post in the freelancing section and hire someone to do it. Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172522 Share on other sites More sharing options...
svenjcvd Posted February 11, 2011 Author Share Posted February 11, 2011 damn dude.... Im from the Netherlands, so maybe i dont correctly express myself...this is not what i ment, you can say that about everbody asking questions on this form...they all just dont want to watch a tuttorial to fix their own problems.. If i ve said im simply not bright enough to come with a solution, its no problem? in the time you're making up smart aswers for my questions, you could have helped me out allready... I think im changing the subject from: "PHP error Form action" to "i dont need your help".. thank you Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172533 Share on other sites More sharing options...
Jessica Posted February 11, 2011 Share Posted February 11, 2011 You've already said you don't want/have time to learn PHP, so the reasonable assumption it that you want someone to write the code for you, and if that is the case, you need to post in the freelancing section and hire someone to do it. Agreed. Did you even try what Pikachu said to do before whining? Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172534 Share on other sites More sharing options...
Pikachu2000 Posted February 11, 2011 Share Posted February 11, 2011 I can tell you the thank you message is not incomplete; it's displaying everything that it's coded to display. Additionally, I'm unable to find any reference whatsoever to a 'Bounce-to' email header, and I don't believe it's even valid. Here's a link to the mail function in the php manual. You should take the time to read it. Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172540 Share on other sites More sharing options...
svenjcvd Posted February 11, 2011 Author Share Posted February 11, 2011 thanks man... sorry for all this... ... Im not asking for someone to make my program...But im asking for some hints.. Which parts are missing and which aren't necessary.. where did i forgot something ; (like you told) i go try to fix it and slowly it will work. i want to understand PHP. ... if you dont believe me check out all the PHPsites im running... [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172542 Share on other sites More sharing options...
Pikachu2000 Posted February 11, 2011 Share Posted February 11, 2011 I enjoy helping people learn, so if that's what you're trying to do, I'll help you all I can. Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172543 Share on other sites More sharing options...
svenjcvd Posted February 11, 2011 Author Share Posted February 11, 2011 Yeah PHP can be nice.. But not now.. I'm 20 minutes away from throwing my laptop around the street.. its just that I'm working on this form for 12+ hours, so I'm kinda messed up... my eyes are like two big 40" plasma-screens... I can't stand it it's not working, so that's why i keep trying.. Till now, i give up for today... Tomorrow i'll give it one more shot... Looking forward to all the helpful posts Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/227281-php-error-form-action/#findComment-1172549 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.