aladiyat23 Posted December 27, 2006 Share Posted December 27, 2006 I searched the forum for a previous thread and couldnt find one, i apologize if it seems repetitive...after hitting submit, my form goes to the php mailer script (datasubmit.php) but then just stops. this form is stripped of all validation and error checks... i attached it here, can anyone help?I should add that this script worked perfectly for another form, but I needed it for a new client and modified it. The only thing I changed was the custom info for the form fields... (i.e., $email, $to... etc.)Thank u in advance :)[attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/ Share on other sites More sharing options...
corbin Posted December 27, 2006 Share Posted December 27, 2006 Umm a asp file and a php file... Does your webserver parse both? Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148147 Share on other sites More sharing options...
aladiyat23 Posted December 27, 2006 Author Share Posted December 27, 2006 yes Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148149 Share on other sites More sharing options...
aladiyat23 Posted December 27, 2006 Author Share Posted December 27, 2006 anybody? :S Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148276 Share on other sites More sharing options...
alpine Posted December 27, 2006 Share Posted December 27, 2006 Your variables defined after post in datasubmit, all start with a number - thats not allowed.From the manual --> http://no2.php.net/manual/en/language.variables.php:[quote]A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.[/quote]So, you should change them to start with f.example an underscore, instead of all those lines like:[color=blue] $1 = $_POST['1']; $2 = $_POST['2']; $3 = $_POST['3']; $4 = $_POST['4']; $5 = $_POST['5']; $6 = $_POST['6']; $7 = $_POST['7'];[/color]You could replace all of that (from line 7 to 84) with this:[code]<?php foreach($_POST as $key => $value){ $key = "_".$key; // add underscore to each posted variable number ${$key} = $value; // define them, becomes $_1 = "value of 1"; etc.}$email = $_8;?>[/code]and altering each variable down the script where you are using them, to include an underscore first.Hope you follow me here... It might be additional problems with your code exept this one that i havent spotted though Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148292 Share on other sites More sharing options...
aladiyat23 Posted December 27, 2006 Author Share Posted December 27, 2006 THank you so much, I'll change what you mentioned and let you know how it goes. :) Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148301 Share on other sites More sharing options...
aladiyat23 Posted December 28, 2006 Author Share Posted December 28, 2006 ok I changed the variables from just numbers... I didnt exactly follow what you said, I know I did it the hard way and just went thru and added an underscore on each. Now the script goes thru to the 'thank you' page, but i dont receive the email. This is frustrating! It worked perfect for another project, all I did was change these variables. Any more advice? I attached the updated scripts...[attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148603 Share on other sites More sharing options...
alpine Posted December 28, 2006 Share Posted December 28, 2006 add this at the very top in the php file:[code]<?phperror_reporting(E_ALL);// rest as it is[/code]and adjust this part:[code] mail($to, $subject, $message, $headers);echo '<META HTTP-EQUIV="REFRESH" CONTENT="1;URL=http://www.aquagirl.org/wcf/success.asp">'; [/code]to:[code]$send = mail($to, $subject, $message, $headers);if($send){ echo "Mail returned true and should be on the way"; //echo '<META HTTP-EQUIV="REFRESH" CONTENT="1;URL=http://www.aquagirl.org/wcf/success.asp">';}else{ echo "Mail returned false: ".$send;}[/code]See what you get Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148662 Share on other sites More sharing options...
aladiyat23 Posted December 28, 2006 Author Share Posted December 28, 2006 woooah... ok, here are the errors that came up:Notice: Undefined index: _10 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 18Notice: Undefined index: _15 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 23Notice: Undefined index: _16 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 24Notice: Undefined index: _17 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 25Notice: Undefined index: _18 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 26Notice: Undefined index: _20 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 28Notice: Undefined index: _21 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 29Notice: Undefined index: _31 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 39Notice: Undefined index: _35 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 43Notice: Undefined index: _38 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 46Notice: Undefined index: _39 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 47Notice: Undefined index: _40 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 48Notice: Undefined index: _41 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 49Notice: Undefined index: _44 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 52Notice: Undefined index: _46 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 54Notice: Undefined index: _48 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 56Notice: Undefined index: _49 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 57Notice: Undefined index: _50 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 58Notice: Undefined index: _51 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 59Notice: Undefined index: _56 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 64Notice: Undefined index: _61 in d:\inetpub\aquagirl\WCF\datasubmit.php on line 69Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in d:\inetpub\aquagirl\WCF\datasubmit.php on line 191Mail returned false: Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148713 Share on other sites More sharing options...
alpine Posted December 28, 2006 Share Posted December 28, 2006 The last warning tells you what your problem is. Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148717 Share on other sites More sharing options...
aladiyat23 Posted December 28, 2006 Author Share Posted December 28, 2006 hmmm... ok. Im not sure how to address the error though :/ Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148719 Share on other sites More sharing options...
alpine Posted December 28, 2006 Share Posted December 28, 2006 It's a configuration problem in your php.ini - smtp setting is wrong/not setlook here: http://www.phpfreaks.com/forums/index.php/topic,118826.msg485989.html#msg485989 Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148727 Share on other sites More sharing options...
aladiyat23 Posted December 28, 2006 Author Share Posted December 28, 2006 ok, thanks for all your help...And for me to understand it better... i ran phpinfo() and found the SMTP info, so I see what needs to be changed but I cant get to the php.ini file. This server is also ran by someone thats running a hundred other accounts from there. I dont have control panel access or anything. They didnt even know about php when I called. SOOOO, I'm trying to understand further by googling and all that crap.What would you do? Is there a way to host the script elsewhere but run the form from there? Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148746 Share on other sites More sharing options...
alpine Posted December 28, 2006 Share Posted December 28, 2006 I'm on rather thin ice here since php config is a foggy area for me, you could try something like this and see what u get:[code]<?php ini_set("SMTP","mail.yourdomain.com"); ini_set("smtp_port","25"); ini_set("sendmail_from","[email protected]"); $send = mail($to, $subject, $message, $headers); ini_restore();?>[/code] Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148757 Share on other sites More sharing options...
aladiyat23 Posted December 28, 2006 Author Share Posted December 28, 2006 i uploaded the script to my own site and when i tested it from there i didnt receive any errors... still havent received the email but I'll give it a few more minutes before trying your last suggestion.Thanks for all your help! Hope I grasp php soon. :) Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148760 Share on other sites More sharing options...
aladiyat23 Posted December 28, 2006 Author Share Posted December 28, 2006 maaaan this is so annoying. I got ONE email and then tried it again and nothing. I put the error script back in there and its not finding any errors. You've helped a lot so I dont know if you know of anything else, thanks for the help :)Regards, Carrie Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148773 Share on other sites More sharing options...
alpine Posted December 28, 2006 Share Posted December 28, 2006 A thought in the end - if the current host aren't even capable of answering simple php config questions, i would seriously consider moving to another host.Ok, good luck! Link to comment https://forums.phpfreaks.com/topic/31926-whats-wrong-with-my-mailer-script/#findComment-148775 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.