ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 Array ( [TEXT_1] => jij [TEXT_20] => jio [TEXT_21] => ji [TEXT_4] => jo [TEXT_2] => i [TEXT_5] => ijk [TEXT_6] => bh [TEXT_7] => vt [TEXT_8] => f [TEXT_9] => b [TEXT_10] => ji [TEXT_11] => ji [TEXT_12] => bg [TEXT_13] => j [TEXT_14] => b [TEXT_15] => nb [TEXT_16] => bvt [TEXT_3] => jio [TEXT_AREA_3] => vy [TEXT_17] => vubiu [TEXT_18] => n ) 1 all those letters are me just fudging the form. Quote Link to comment Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 Hi, I solved this issue by myself. Thanks for the help! Quote Link to comment Share on other sites More sharing options...
ramboangel11 Posted December 15, 2009 Author Share Posted December 15, 2009 $message = "{$_POST['$TEXT_1']}{$_POST['$TEXT_20']}{$_POST['TEXT_21']}{$_POST['TEXT_4']}{$_POST['TEXT_2']}{$_POST['TEXT_5']}{$_POST['TEXT_6']}{$_POST['TEXT_7']}{$_POST['TEXT_8']}{$_POST['TEXT_9']}{$_POST['TEXT_10']}{$_POST['TEXT_11']}{$_POST['TEXT_12']}{$_POST['TEXT_13']}{$_POST['TEXT_14']}{$_POST['TEXT_15']}{$_POST['TEXT_16']}{$_POST['TEXT_3']}{$_POST['TEXT_AREA_3']}{$_POST['TEXT_17']}{$_POST['TEXT_18']}"; Where can I insert PHP LINE BREAKS? \n? Quote Link to comment Share on other sites More sharing options...
trq Posted December 15, 2009 Share Posted December 15, 2009 Wherever you like. Quote Link to comment Share on other sites More sharing options...
otuatail Posted December 15, 2009 Share Posted December 15, 2009 I think this is your problem mail( "myemail@aol.com", "Referral Form Results", $message, "From: $TEXT_7" ) 1) What is $TEXT_7? The format must be From: $name <$from>\r\n You need <> and it must have new line \r\n 2) a properly formed mail() function has 5 parts. Add a last parameter. '-froot@mywebsite.com' This must be the real name! 3) AOL is a pain in the arse. It can recect emails with no reverse DNS. I should know, I am one. Desmond. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted December 15, 2009 Share Posted December 15, 2009 Which aspects of my code should be changed to $_POST? I'm fairly new to PHP...heh. All of them. POST / GET are the only methods of passing variables between forms. Quote Link to comment Share on other sites More sharing options...
ramboangel11 Posted December 16, 2009 Author Share Posted December 16, 2009 $message = "Referrer's Name: {$_POST['TEXT_20']}\nPosition: {$_POST['TEXT_21']}\nAgency: {$_POST['TEXT_4']}\nEmail: {$_POST['TEXT_2']}\nDate: {$_POST['TEXT_5']}\nPhone: {$_POST['TEXT_6']}\nClient's Name: {$_POST['TEXT_7']}\nBirthdate: {$_POST['TEXT_8']}\nSSN: {$_POST['TEXT_9']}\nRace: {$_POST['TEXT_10']}\nGender: {$_POST['TEXT_11']}\nStreet Address: {$_POST['TEXT_12']}\nCity: {$_POST['TEXT_13']}\nZip Code: {$_POST['TEXT_14']}\nCounty: {$_POST['TEXT_15']}\nSchool: {$_POST['TEXT_16']}\nCurrent Placement: {$_POST['TEXT_1']}\nParent/Guardian Name: {$_POST['TEXT_22']}\nRelationship: {$_POST['TEXT_23']}\nHome Phone: {$_POST['TEXT_24']}\nCell: {$_POST['TEXT_25']}\nWork: {$_POST['TEXT_26']}\nMedicaid No: {$_POST['TEXT_27']}\nPeachCare No: {$_POST['TEXT_28']}\nOther: {$_POST['TEXT_29']}\nServices Needed: {$_POST['TEXT_30']}\nReason for requesting IFIS: {$_POST['TEXT_AREA_3']}\n5-21 yrs old? {$_POST['TEXT_31']}\nAt risk of out of home placement? {$_POST['TEXT_32']}\nMental Health Diagnosis? {$_POST['TEXT_33']}\nExpressed ideations or attempted suicide or homicide? {$_POST['TEXT_34']}\nCommitted acts of physical or verbal aggression against a parent, teacher, or peer? {$_POST['TEXT_35']}"; if ($_SERVER['REQUEST_METHOD'] == 'POST') { mail( "myemail@aol.com", "Referral Form Results", $message, "From: example@aol.com" ); header( "Location: http://www.example.com" ); }else{ die("Direct access not allowed!"); } I've been searching for awhile now on how to validate each individual element of my array $message, and I just can't seem to figure it out. Nothing works! Does anybody know how to validate each element without having to revamp my whole code? Quote Link to comment Share on other sites More sharing options...
trq Posted December 16, 2009 Share Posted December 16, 2009 Obviously your going to need to revamp your code because each element needs (most likely) to be validated for specific data. What exactly do you want to validate? Quote Link to comment Share on other sites More sharing options...
ramboangel11 Posted December 16, 2009 Author Share Posted December 16, 2009 Well I want to validate each text-field of my form. Let me tell you this: I originally had each individual barrier in a list. However, I couldn't figure out how to get all of the variables into the body of the email (i was tired, it was late) so my sister suggested I concatenate them into one array. Worked after a little bit of tweaking. Well, I'd like to make my form as secure as possible, so I realized I need to validate each variable (especially since I don't want to receive blank forms AT ALL). I hope that's a good explanation. Thanks! Quote Link to comment Share on other sites More sharing options...
ramboangel11 Posted December 29, 2009 Author Share Posted December 29, 2009 BUMP ^^^^^^^^ Quote Link to comment Share on other sites More sharing options...
ramboangel11 Posted December 29, 2009 Author Share Posted December 29, 2009 <?php $ebits = ini_get('error_reporting'); error_reporting($ebits ^ E_NOTICE); $name = $_POST['name'] ; $email = $_POST['email'] ; $message = $_POST['message'] ; if (!isset($_POST['email'])) { } elseif (empty($name) || empty($email) || empty($message)) { header( "Expires: Mon, 20 Dec 2008 01:00:00 GMT" ); header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" ); header( "Cache-Control: no-cache, must-revalidate" ); header( "Pragma: no-cache" ); ?> <html> <head> <title></title> <style type="text/css"> p {font-family: arial; font-size: 16px; color: #000000;} p1 {font-family: arial; font-size: 24px; color: #000000;} </style> </head> <body style="background-color: #a1e4a4;"> <p1>ERROR</p1> <br /><br /> <p>Please go back and fill in all fields completely.</p> </body> </html> <?php } else { mail( "myemail@domain.com", "Contact Form Results", $message, "From: $name <$email>" ); header( "Location: thankyou.htm" ); } ?> Hello again! Php hates me on different servers... This is my code to send the maill to my email. I get no errors returned, and it redirects to the thankyou page like it successfully sent the email, however, no email in my inbox, and none in spam either... All my variables are labeled correctly, and the action of my form is set to this .php page. Why won't I get an email? Help!!! Thank you! Quote Link to comment Share on other sites More sharing options...
ramboangel11 Posted December 29, 2009 Author Share Posted December 29, 2009 OKAY, now the email sends with this code: <?php $ebits = ini_get('error_reporting'); error_reporting($ebits ^ E_NOTICE); $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; if (!isset($_REQUEST['email'])) { } elseif (empty($name) || empty($email) || empty($message)) { header( "Expires: Mon, 20 Dec 2008 01:00:00 GMT" ); header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" ); header( "Cache-Control: no-cache, must-revalidate" ); header( "Pragma: no-cache" ); } ?> <html> <head> <title></title> <style type="text/css"> p {font-family: arial; font-size: 16px; color: #000000;} p1 {font-family: arial; font-size: 24px; color: #000000;} </style> </head> <body style="background-color: #a1e4a4;"> <p1>ERROR</p1> <br /><br /> <p>Please go back and fill in all fields completely.</p> </body> </html> <?php mail( "myemail@domain.com", "Contact Form Results", $message, "From: $name <$email>" ); header( "Location: thankyou.htm" ); ?> So it sends successfully, but this is what it redirects to after you hit submit. I must be missing something... ERROR Please go back and fill in all fields completely. Warning: Cannot modify header information - headers already sent by /TEST/sendmail.php on line 48 Quote Link to comment Share on other sites More sharing options...
ignace Posted December 29, 2009 Share Posted December 29, 2009 The HTML form was already pre-coded by a previous developer who really had no clue what they were doing. I'm fairly new to PHP...heh. I'm guessing you were that previous developer.. Quote Link to comment Share on other sites More sharing options...
ramboangel11 Posted December 29, 2009 Author Share Posted December 29, 2009 No, they used a program called ABS or something along those lines that precodes for you. Very old program and not up to date with current coding standards. And anyway my question isn't for that project anymore. Just a regular php/html coding question. 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.