wholetthe15 Posted March 11, 2007 Share Posted March 11, 2007 Hey, i need some help setting up an e-mail form. i have tried all day and cant seem to get it right. my form is HTML and here it is: <style type="text/css">.fieldstyle{font-family: Georgia; font-size: 14px; font-weight: normal; color: #0000CC; background-color: #00FF00; border: 1px solid #000000; vertical-align: middle}</style> <form name="contactform" method="post" action="mailer.php"> <input name="user" type="hidden" id="user" value="wholetthe15"><input name="formid" type="hidden" id="formid" value="95579"> <table width="50%" border="0" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#FF6600"><tr><td> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr bgcolor="#EFEFEF"><td><font color="#FF3300" size="2" face="Times"><b> Subject:<font color="#FF0000"> *</font></b></font></td><td><select name="subject" id="subject" class="fieldstyle"><option value="Job">Job</option><option value="Disk-Jocky">Disk-Jocky</option><option value="Administration">Administration</option><option value="News Reporter">News Reporter</option><option value="Rare Values">Rare Values</option><option value="Other">Other</option></select></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>First Name:</b></font></td><td><font color="#FF3300" size="2" face="Times"><input name="firstname" type="text" id="firstname" value="" size="" maxlength="" class="fieldstyle"></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#FF3300" size="2" face="Times"><b>Last Name:</b></font></td><td><font color="#FF3300" size="2" face="Times"><input name="q[2]" type="text" id="q[2]" value="" size="" maxlength="" class="fieldstyle"></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>Age:<font color="#FF0000"> *</font></b></font></td><td><font color="#FF3300" size="2" face="Times"><select name="q[3]" id="q[3]" class="fieldstyle"><option value="Age">Age</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18+">18+</option></select></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#FF3300" size="2" face="Times"><b>Gender:<font color="#FF0000"> *</font></b></font></td><td><font color="#FF3300" size="2" face="Times"><select name="q[4]" id="q[4]" class="fieldstyle"><option value="Gender">Gender</option><option value="Male">Male</option><option value="Female">Female</option></select></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>Country:<font color="#FF0000"> *</font></b></font></td><td><font color="#FF3300" size="2" face="Times"><input name="q[21]" type="text" id="q[21]" value="" size="" maxlength="" class="fieldstyle"></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>State:<font color="#FF0000"> *</font></b></font></td><td><font color="#FF3300" size="2" face="Times"><input name="q[41]" type="text" id="q[41]" value="" size="" maxlength="" class="fieldstyle"></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#FF3300" size="2" face="Times"><b>Dj Name:</b></font></td><td><font color="#FF3300" size="2" face="Times"><input name="q[5]" type="text" id="q[5]" value="" size="" maxlength="" class="fieldstyle"></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>Habbo Name:<font color="#FF0000"> *</font></b></font></td><td><font color="#FF3300" size="2" face="Times"><input name="q[7]" type="text" id="q[7]" value="" size="" maxlength="" class="fieldstyle"></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#FF3300" size="2" face="Times"><b> E-mail Address:<font color="#FF0000"> *</font></b></font></td><td><input name="email" type="text" id="email" size="20" maxlength="100" class="fieldstyle"></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>Desired password:<font color="#FF0000"> *</font></b></font></td><td><font color="#FF3300" size="2" face="Times"><input name="q[8]" type="text" id="q[8]" value="" size="" maxlength="" class="fieldstyle"></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#FF3300" size="2" face="Times"><b>Other Experience:</b></font></td><td><font color="#FF3300" size="2" face="Times"><textarea name="q[9]" cols="40" rows="" class="fieldstyle"></textarea></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>How long have you been a DJ For:</b></font></td><td><font color="#FF3300" size="2" face="Times"><textarea name="q[10]" cols="40" rows="" class="fieldstyle"></textarea></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#FF3300" size="2" face="Times"><b>Communicating:</b></font></td><td><font color="#FF3300" size="2" face="Times"><select name="q[11]" id="q[11]" class="fieldstyle"><option value="Communication">Communication</option><option value="Very good, Not Shy">Very good, Not Shy</option><option value="Good, Can talk clearly">Good, Can talk clearly</option><option value="Sometimes Scared">Sometimes Scared</option><option value="Im shy, dont talk much">Im shy, dont talk much</option><option value="Too Scare, Dont talk">Too Scare, Dont talk</option></select></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>Do you create competitions:</b></font></td><td><font color="#FF3300" size="2" face="Times"><select name="q[12]" id="q[12]" class="fieldstyle"><option value="Competitions">Competitions</option><option value="Yes">Yes</option><option value="No">No</option></select></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#FF3300" size="2" face="Times"><b>Can you follow requests:</b></font></td><td><font color="#FF3300" size="2" face="Times"><select name="q[13]" id="q[13]" class="fieldstyle"><option value="Requests">Requests</option><option value="Yes">Yes</option><option value="No">No</option></select></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>Do you have a Mic:</b></font></td><td><font color="#FF3300" size="2" face="Times"><select name="q[14]" id="q[14]" class="fieldstyle"><option value="Mic">Mic</option><option value="Yes">Yes</option><option value="No">No</option></select></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#FF3300" size="2" face="Times"><b>Do you have over 50 tracks:</b></font></td><td><font color="#FF3300" size="2" face="Times"><select name="q[15]" id="q[15]" class="fieldstyle"><option value="Tracks">Tracks</option><option value="Yes">Yes</option><option value="No">No</option></select></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>Do you use Winamp:</b></font></td><td><font color="#FF3300" size="2" face="Times"><select name="q[16]" id="q[16]" class="fieldstyle"><option value="Winamp">Winamp</option><option value="Yes">Yes</option><option value="No">No</option></select></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#FF3300" size="2" face="Times"><b>Do you use SAM:</b></font></td><td><font color="#FF3300" size="2" face="Times"><select name="q[17]" id="q[17]" class="fieldstyle"><option value="SAM">SAM</option><option value="Yes">Yes</option><option value="No">No</option></select></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>Do you use something else:</b></font></td><td><font color="#FF3300" size="2" face="Times"><textarea name="q[18]" cols="40" rows="" class="fieldstyle">Yes, I use....</textarea></font></td></tr><tr bgcolor="#EFEFEF"><td><font color="#FF3300" size="2" face="Times"><b>Why would you like to be a DJ at Habbov:</b></font></td><td><font color="#FF3300" size="2" face="Times"><textarea name="q[19]" cols="40" rows="" class="fieldstyle"></textarea></font></td></tr><tr bgcolor="#FFFFFF"><td><font color="#FF3300" size="2" face="Times"><b>Why should we choose you to work at Habbov:<font color="#FF0000"> *</font></b></font></td><td><font color="#FF3300" size="2" face="Times"><textarea name="q[20]" cols="40" rows="" class="fieldstyle"></textarea></font></td></tr><tr><td colspan="2"><hr size="1"></td></tr> <tr><td colspan="2"><input name="submit" type="submit" style="button: #FFFFFF; font: Arial; font-size: 16; color: #000000; border-bottom:2px solid #000000; border-right:2px solid #000000; border-top:2px solid #000000; border-left:2px solid #000000" value="Submit"> <input name="reset" type="reset" style="button: #FFFFFF; font: Arial; font-size: 16; color: #000000; border-bottom:2px solid #000000; border-right:2px solid #000000; border-top:2px solid #000000; border-left:2px solid #000000" value="Reset"> </td></tr> <tr><td><font color="#FF0000" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>*</b></font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">Required</font></td><td align="right"></font></td></tr> </table></td></tr></table></form> So from that i tried to make a php script that didn't work out so well. the script is: <?php // Simple form to email script by ivy (request on CodingForums.com) //Fields to acknowledge from submitted form $from_subject= @$HTTP_POST_VARS['subject']; $from_firstname= @$HTTP_POST_VARS['q[1]']; $from_lastname= @$HTTP_POST_VARS['q[2]']; $from_age= @$HTTP_POST_VARS['q[3]']; $from_gender= @$HTTP_POST_VARS['q[4]']; $from_country= @$HTTP_POST_VARS['q[21]']; $from_state= @$HTTP_POST_VARS['q[41]']; $from_djname= @$HTTP_POST_VARS['q[5]']; $from_habboname= @$HTTP_POST_VARS['q[7]']; $from_email= @$HTTP_POST_VARS['email']; $from_desiredpass= @$HTTP_POST_VARS['q[8]']; $from_experience= @$HTTP_POST_VARS['q[9]']; $from_djtime= @$HTTP_POST_VARS['q[10]']; $from_communicating= @$HTTP_POST_VARS['q[11]']; $from_competitions= @$HTTP_POST_VARS['q[12]']; $from_requests= @$HTTP_POST_VARS['q[13]']; $from_mic= @$HTTP_POST_VARS['q[14]']; $from_tracks= @$HTTP_POST_VARS['q[15]']; $from_winamp= @$HTTP_POST_VARS['q[16]']; $from_sam= @$HTTP_POST_VARS['q[17]']; $from_other= @$HTTP_POST_VARS['q[18]']; $from_reason= @$HTTP_POST_VARS['q[19]']; $from_why= @$HTTP_POST_VARS['q[20]']; //The message that will be sent in the email, composed of the inputted fields on separate lines $message = "Job: $from_job\r\nFirst Name: $from_firstname\r\nLast Name: $from_lastname\r\nAge: $from_age\r\nGender: $from_gender\r\nCountry: $from_country\r\nState: $from_state\r\nDj Name: $from_djname\r\nHabbo Name: $from_habboname\r\nE-mail: $from_email\r\nPassword: $from_desiredpass\r\nExperience: $from_experience\r\nHow long have you DJ'd: $from_djtime\r\nCommunication: $from_communicating\r\nCompetitions: $from_competitions\r\nRequests: $from_requests\r\nMic: $from_mic\r\nTracks: $from_tracks\r\nWinamp: $from_winamp\r\nSam: $from_sam\r\nUse something Else: $from_other\r\nWhy do you want to DJ: $from_reason\r\nWhy should we hire you: $from_why\r\n"; //Email to send form data to $send_to = "MY E-MAIL HERE"; // Subject for email $subject = "App"; ////// Redirect user after submitting form $redirect_thankyou = 'http://www.mysite.net/thankyou.php'; $redirect_error = 'http://www.mysite.net/error.html'; // NO NEED TO EDIT BELOW HERE !!! //Header for from email address - YOU DO NOT NEED TO EDIT THIS $from_header = "From: $from_email\r\n"; if ( mail($send_to,$subject,$message,$from_header) ) { header("Location: $redirect_thankyou"); exit(); } else { header("Location: $redirect_error"); exit(); } ?> I got the e-mail part to work. i get an e-mail with the things in it, but their responses are blank. So i bassically get just the questions, with a blank e-mail. Can someone please help me? Thanks =) Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/ Share on other sites More sharing options...
trq Posted March 11, 2007 Share Posted March 11, 2007 HTTP_POST_VARS Has long been depricated in favour of the shorter $_POST array. Your syntax is also off. Try... $from_country = $_POST[$q[21]]; As an example. Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205039 Share on other sites More sharing options...
wholetthe15 Posted March 11, 2007 Author Share Posted March 11, 2007 nope still nothing the only thing thats shows up in the e-mail is the persons e-mail that they type in. the rest is all blank :-\ Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205043 Share on other sites More sharing options...
Blekk Posted March 11, 2007 Share Posted March 11, 2007 I don't have time to look over it much right now, but I have created a little emailer, that stores the message and subject into a mysql database aswell as emailing the message. I would be happy to share the code, bearing in mind it is still in beta. Just email me at: [email protected] I will give you the code, but it would be good if you could learn from it rather than copy and paste, so just email me if you do not understand any aspects and I would be happy to help. Thanks, Tom P.S. Some parts of this post look to me like I'm being bigheaded, but I assure you that that is not intentional. Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205047 Share on other sites More sharing options...
wholetthe15 Posted March 11, 2007 Author Share Posted March 11, 2007 lol thanks for the offer, but that sounds too complicated. If someone could please look over my first post and let me know what i'm doing wrong then i would greatly appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205059 Share on other sites More sharing options...
trq Posted March 11, 2007 Share Posted March 11, 2007 The problem is that your form (html) is so poorly formatted its near impossible to read. Place this.... print_r($_POST);exit; At the top of your mailer.php page and let us see the results of a form submission. Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205064 Share on other sites More sharing options...
wholetthe15 Posted March 11, 2007 Author Share Posted March 11, 2007 i used to get just a blank e-mail but now it says this when i hit submit (this is once i put print_r($_POST);exit; at the top of my mailer.php) Array ( [user] => wholetthe15 [formid] => 95579 [subject] => Disk-Jocky [firstname] => Test [q] => Array ( [2] => Test [3] => 13 [4] => Male [21] => Test [41] => Test [5] => Test [7] => Test [8] => Test [9] => TestTestTestTestTestTestTestTestTestTest [10] => TestTestTestTestTestTestTest [11] => Good, Can talk clearly [12] => Yes [13] => No [14] => No [15] => Yes [16] => Yes [17] => No [18] => Yes, I use....TestTest [19] => fhlTestTestTest [20] => hflfhlTestTestTest ) [email] => [email protected] [submit] => Submit ) Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205068 Share on other sites More sharing options...
redarrow Posted March 11, 2007 Share Posted March 11, 2007 Try this please any error tell me dont @ <<<=hide them ok <?php // Simple form to email script by ivy (request on CodingForums.com) //Fields to acknowledge from submitted form $from_subject=$_POST['subject']; $from_firstname= $_POST['q[1]']; $from_lastname= $_POST['q[2]']; $from_age= $_POST['q[3]']; $from_gender= $_POST_VARS['q[4]']; $from_country= $_POST['q[21]']; $from_state= $_POST['q[41]']; $from_djname= $_POST['q[5]']; $from_habboname= $_POST['q[7]']; $from_email= $_POST['email']; $from_desiredpass= $_POST['q[8]']; $from_experience= $_POST['q[9]']; $from_djtime= $_POST['q[10]']; $from_communicating= $_POST['q[11]']; $from_competitions= $_POST['q[12]']; $from_requests= $_POST['q[13]']; $from_mic= $_POST['q[14]']; $from_tracks= $_POST['q[15]']; $from_winamp= $_POST['q[16]']; $from_sam= $_POST['q[17]']; $from_other= $_POST['q[18]']; $from_reason= $_POST['q[19]']; $from_why= $_POST['q[20]']; if($_POST_['submit']){ //The message that will be sent in the email, composed of the inputted fields on separate lines $message = "Job: $from_job\r\nFirst Name: $from_firstname\r\nLast Name: $from_lastname\r\nAge: $from_age\r\nGender: $from_gender\r\nCountry: $from_country\r\nState: $from_state\r\nDj Name: $from_djname\r\nHabbo Name: $from_habboname\r\nE-mail: $from_email\r\nPassword: $from_desiredpass\r\nExperience: $from_experience\r\nHow long have you DJ'd: $from_djtime\r\nCommunication: $from_communicating\r\nCompetitions: $from_competitions\r\nRequests: $from_requests\r\nMic: $from_mic\r\nTracks: $from_tracks\r\nWinamp: $from_winamp\r\nSam: $from_sam\r\nUse something Else: $from_other\r\nWhy do you want to DJ: $from_reason\r\nWhy should we hire you: $from_why\r\n"; //Email to send form data to $send_to = "MY E-MAIL HERE"; // Subject for email $subject = "App"; ////// Redirect user after submitting form $redirect_thankyou = 'http://www.mysite.net/thankyou.php'; $redirect_error = 'http://www.mysite.net/error.html'; // NO NEED TO EDIT BELOW HERE !!! //Header for from email address - YOU DO NOT NEED TO EDIT THIS $from_header = "From: $from_email\r\n"; if ( mail($send_to,$subject,$message,$from_header) ) { header("Location: $redirect_thankyou"); exit(); } else { header("Location: $redirect_error"); exit(); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205084 Share on other sites More sharing options...
wholetthe15 Posted March 11, 2007 Author Share Posted March 11, 2007 i dont get what you were saying by dont @ hide them... but ok. anyways now when i put that into the mailer.php and then i hit submit i just get a blank page now. no e-mail or anything. and yes i did type in the url for the error, and for the thank you page. its just a blank screen now =/ Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205093 Share on other sites More sharing options...
JasonLewis Posted March 12, 2007 Share Posted March 12, 2007 when you place an @ in front of something it forces php to hide an error that may occur. try changing this line: if($_POST_['submit']){ to this: if(isset($_POST['submit'])){ because i dont understand what the 2nd underscore is for. Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205096 Share on other sites More sharing options...
redarrow Posted March 12, 2007 Share Posted March 12, 2007 if($_POST_['submit']){ to if($_POST['submit']){ sorry Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205097 Share on other sites More sharing options...
wholetthe15 Posted March 12, 2007 Author Share Posted March 12, 2007 Now i get an e-mail like i did before, but once again its blank. this is all that in the e-mail Their answers are blank. Job: First Name: Last Name: Age: Gender: Country: State: Dj Name: Habbo Name: E-mail: fgsh Password: Experience: How long have you DJ'd: Communication: Competitions: Requests: Mic: Tracks: Winamp: Sam: Use something Else: Why do you want to DJ: Why should we hire you: Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205099 Share on other sites More sharing options...
trq Posted March 12, 2007 Share Posted March 12, 2007 Look at the array that is returned. You have fileds defined in the form that aren't defined within your php and vice versa. For instance... $from_firstname= $_POST['q[1]']; should be.... $from_firstname= $_POST['firstname']; Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205103 Share on other sites More sharing options...
redarrow Posted March 12, 2007 Share Posted March 12, 2007 yes and i can see why the code is correct you need to correct the ".$varables." dont u? Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205104 Share on other sites More sharing options...
redarrow Posted March 12, 2007 Share Posted March 12, 2007 HEADER HEADER look ??????????? corrected anyway? <?php // Simple form to email script by ivy (request on CodingForums.com) //Fields to acknowledge from submitted form $from_subject=$_POST['subject']; $from_firstname= $_POST['q[1]']; $from_lastname= $_POST['q[2]']; $from_age= $_POST['q[3]']; $from_gender= $_POST_VARS['q[4]']; $from_country= $_POST['q[21]']; $from_state= $_POST['q[41]']; $from_djname= $_POST['q[5]']; $from_habboname= $_POST['q[7]']; $from_email= $_POST['email']; $from_desiredpass= $_POST['q[8]']; $from_experience= $_POST['q[9]']; $from_djtime= $_POST['q[10]']; $from_communicating= $_POST['q[11]']; $from_competitions= $_POST['q[12]']; $from_requests= $_POST['q[13]']; $from_mic= $_POST['q[14]']; $from_tracks= $_POST['q[15]']; $from_winamp= $_POST['q[16]']; $from_sam= $_POST['q[17]']; $from_other= $_POST['q[18]']; $from_reason= $_POST['q[19]']; $from_why= $_POST['q[20]']; if($_POST['submit']){ //The message that will be sent in the email, composed of the inputted fields on separate lines $message = "Job: ".$from_job."\r\nFirst Name: ".$from_firstname."\r\nLast Name: ".$from_lastnam." \r\nAge: ".$from_age."\r\nGender: ".$from_gender."\r\nCountry: ".$from_country."\r\nState: ".$from_state."\r\nDj Name: ". $from_djname."\r\nHabbo Name: ".$from_habboname."\r\nE-mail: ".$from_email."\r\nPassword: ".$from_desiredpass." \r\nExperience: ".$from_experience."\r\nHow long have you DJ'd: ".$from_djtime."\r\nCommunication: ".$from_communicating." \r\nCompetitions: ".$from_competitions."\r\nRequests: ".$from_requests."\r\nMic: ".$from_mic." \r\nTracks: ".$from_tracks."\r\nWinamp: ".$from_winamp."\r\nSam: ".$from_sam."\r\nUse something Else: ".$from_other." \r\nWhy do you want to DJ: ".$from_reason."\r\nWhy should we hire you: ".$from_why."\r\n"; //Email to send form data to $send_to = "MY E-MAIL HERE"; // Subject for email $subject = "App"; ////// Redirect user after submitting form $redirect_thankyou = 'http://www.mysite.net/thankyou.php'; $redirect_error = 'http://www.mysite.net/error.html'; // NO NEED TO EDIT BELOW HERE !!! //Header for from email address - YOU DO NOT NEED TO EDIT THIS $from_header="From: $from_email\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; if ( mail($send_to,$subject,$message,$from_header) ) { header("Location: $redirect_thankyou"); exit(); } else { header("Location: $redirect_error"); exit(); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205107 Share on other sites More sharing options...
wholetthe15 Posted March 12, 2007 Author Share Posted March 12, 2007 Look at the array that is returned. You have fileds defined in the form that aren't defined within your php and vice versa. For instance... $from_firstname= $_POST['q[1]']; should be.... $from_firstname= $_POST['firstname']; that was only for the first one, i was testing it out and i tried firstname and i changed it on the mailer too. but it didn't work so i figured that wasn't the problem. but if you look at all the other ones they should be correct. Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205121 Share on other sites More sharing options...
trq Posted March 12, 2007 Share Posted March 12, 2007 Well, $_POST['q[1]']; is never going to be correct because it is syntactly incorrect. Should be... $_POST[$q[1]]; Make all the changes and repost your code. while your at it you might want to format your html form so its readable. Makes it much easier to get help. Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205135 Share on other sites More sharing options...
redarrow Posted March 12, 2007 Share Posted March 12, 2007 Done it for you sorry i missed that dam !!!!!!!!!!! <?php // Simple form to email script by ivy (request on CodingForums.com) //Fields to acknowledge from submitted form $from_subject=($_POST['subject']); $from_firstname= $_POST[$q[1]]; $from_lastname= $_POST[$q[2]]; $from_age= $_POST[$q[3]]; $from_gender= $_POST_VARS[$q[4]]; $from_country= $_POST[$q[21]]; $from_state= $_POST[$q[41]]; $from_djname= $_POST[$q[5]]; $from_habboname= $_POST[$q[7]]; $from_email= ($_POST['email']); $from_desiredpass= $_POST[$q[8]]; $from_experience= $_POST[$q[9]]; $from_djtime= $_POST[$q[10]]; $from_communicating= $_POST[$q[11]]; $from_competitions= $_POST[$q[12]]; $from_requests= $_POST[$q[13]]; $from_mic= $_POST[$q[14]]; $from_tracks= $_POST[$q[15]]; $from_winamp= $_POST[$q[16]]; $from_sam= $_POST[$q[17]]; $from_other= $_POST[$q[18]]; $from_reason= $_POST[$q[19]]; $from_why= $_POST[$q[20]]; if($_POST['submit']){ //The message that will be sent in the email, composed of the inputted fields on separate lines $message = "Job: ".$from_job."\r\nFirst Name: ".$from_firstname."\r\nLast Name: ".$from_lastnam." \r\nAge: ".$from_age."\r\nGender: ".$from_gender."\r\nCountry: ".$from_country."\r\nState: ".$from_state."\r\nDj Name: ". $from_djname."\r\nHabbo Name: ".$from_habboname."\r\nE-mail: ".$from_email."\r\nPassword: ".$from_desiredpass." \r\nExperience: ".$from_experience."\r\nHow long have you DJ'd: ".$from_djtime."\r\nCommunication: ".$from_communicating." \r\nCompetitions: ".$from_competitions."\r\nRequests: ".$from_requests."\r\nMic: ".$from_mic." \r\nTracks: ".$from_tracks."\r\nWinamp: ".$from_winamp."\r\nSam: ".$from_sam."\r\nUse something Else: ".$from_other." \r\nWhy do you want to DJ: ".$from_reason."\r\nWhy should we hire you: ".$from_why."\r\n"; //Email to send form data to $send_to = "MY E-MAIL HERE"; // Subject for email $subject = "App"; ////// Redirect user after submitting form $redirect_thankyou = 'http://www.mysite.net/thankyou.php'; $redirect_error = 'http://www.mysite.net/error.html'; // NO NEED TO EDIT BELOW HERE !!! //Header for from email address - YOU DO NOT NEED TO EDIT THIS $from_header="From: $from_email\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; if ( mail($send_to,$subject,$message,$from_header) ) { header("Location: $redirect_thankyou"); exit(); } else { header("Location: $redirect_error"); exit(); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205138 Share on other sites More sharing options...
wholetthe15 Posted March 12, 2007 Author Share Posted March 12, 2007 this is what i get in the e-mail Job: First Name: Last Name: Age: Gender: Country: State: Dj Name: Habbo Name: E-mail: fgsh Password: Experience: How long have you DJ'd: Communication: Competitions: Requests: Mic: Tracks: Winamp: Sam: Use something Else: Why do you want to DJ: Why should we hire you: nothing is answered. i really dont know what wrong =/ Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205145 Share on other sites More sharing options...
redarrow Posted March 12, 2007 Share Posted March 12, 2007 can you echo out the $_POST please and see your form cheers. Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205149 Share on other sites More sharing options...
wholetthe15 Posted March 12, 2007 Author Share Posted March 12, 2007 can you echo out the $_POST please and see your form cheers. echo out the post? i have no idea what that means. PHP and I arn't really good friends yet. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205151 Share on other sites More sharing options...
redarrow Posted March 12, 2007 Share Posted March 12, 2007 put this on the top of the page please ok. show the results. <?php print_f($_POST); ?> Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205155 Share on other sites More sharing options...
wholetthe15 Posted March 12, 2007 Author Share Posted March 12, 2007 Now it says Parse error: parse error, unexpected T_VARIABLE in /homepages/38/d161202988/htdocs/Habbov/mailer.php on line 7 heres the code i have: <?php // Simple form to email script by ivy (request on CodingForums.com) print_r($_POST);exit //Fields to acknowledge from submitted form $from_subject=($_POST['subject']); $from_firstname= $_POST[$q[1]]; $from_lastname= $_POST[$q[2]]; $from_age= $_POST[$q[3]]; $from_gender= $_POST_VARS[$q[4]]; $from_country= $_POST[$q[21]]; $from_state= $_POST[$q[41]]; $from_djname= $_POST[$q[5]]; $from_habboname= $_POST[$q[7]]; $from_email= ($_POST['email']); $from_desiredpass= $_POST[$q[8]]; $from_experience= $_POST[$q[9]]; $from_djtime= $_POST[$q[10]]; $from_communicating= $_POST[$q[11]]; $from_competitions= $_POST[$q[12]]; $from_requests= $_POST[$q[13]]; $from_mic= $_POST[$q[14]]; $from_tracks= $_POST[$q[15]]; $from_winamp= $_POST[$q[16]]; $from_sam= $_POST[$q[17]]; $from_other= $_POST[$q[18]]; $from_reason= $_POST[$q[19]]; $from_why= $_POST[$q[20]]; if($_POST['submit']){ //The message that will be sent in the email, composed of the inputted fields on separate lines $message = "Job: ".$from_job."\r\nFirst Name: ".$from_firstname."\r\nLast Name: ".$from_lastnam." \r\nAge: ".$from_age."\r\nGender: ".$from_gender."\r\nCountry: ".$from_country."\r\nState: ".$from_state."\r\nDj Name: ". $from_djname."\r\nHabbo Name: ".$from_habboname."\r\nE-mail: ".$from_email."\r\nPassword: ".$from_desiredpass." \r\nExperience: ".$from_experience."\r\nHow long have you DJ'd: ".$from_djtime."\r\nCommunication: ".$from_communicating." \r\nCompetitions: ".$from_competitions."\r\nRequests: ".$from_requests."\r\nMic: ".$from_mic." \r\nTracks: ".$from_tracks."\r\nWinamp: ".$from_winamp."\r\nSam: ".$from_sam."\r\nUse something Else: ".$from_other." \r\nWhy do you want to DJ: ".$from_reason."\r\nWhy should we hire you: ".$from_why."\r\n"; //Email to send form data to $send_to = "[email protected]"; // Subject for email $subject = "Habbov App"; ////// Redirect user after submitting form $redirect_thankyou = 'http://www.habbov.net/thankyou.php'; $redirect_error = 'http://www.habbov.net/error.html'; // NO NEED TO EDIT BELOW HERE !!! //Header for from email address - YOU DO NOT NEED TO EDIT THIS $from_header="From: $from_email\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; if ( mail($send_to,$subject,$message,$from_header) ) { header("Location: $redirect_thankyou"); exit(); } else { header("Location: $redirect_error"); exit(); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205166 Share on other sites More sharing options...
JasonLewis Posted March 12, 2007 Share Posted March 12, 2007 look: print_r($_POST);exit you dont need the exit there, or if you do place it like this: print_r($_POST); exit; see the ;? Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205192 Share on other sites More sharing options...
wholetthe15 Posted March 12, 2007 Author Share Posted March 12, 2007 ook when i get put that post_exit thingy i get this... Array ( [user] => wholetthe15 [formid] => 95579 [subject] => Disk-Jocky [firstname] => dfg [q] => Array ( [2] => dfg [3] => Age [4] => Gender [21] => fsgh [41] => fsgh [5] => fsgh [7] => fgsh [8] => fsgh [9] => fsgh [10] => fsgh [11] => Communication [12] => Yes [13] => No [14] => Mic [15] => No [16] => Winamp [17] => SAM [18] => Yes, I ufghe.... [19] => fsgh [20] => fsgh ) => fgsh [submit] => Submit ) any help? Quote Link to comment https://forums.phpfreaks.com/topic/42268-e-mail-form/#findComment-205808 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.