ball420 Posted August 30, 2007 Share Posted August 30, 2007 my script will not send nor will the validation work please help it's much appreciated the error i'm recieving is Parse error: parse error, unexpected T_ELSE in /homepages/2/d207814309/htdocs/met/mailer.php on line 194 line 194 under the exit; and above echo at the very bottom Thanks again for all the help <?php if(isset($_POST['submit'])) { $errmsg = ''; // error message $nextstep = "nextstep.php"; $name_field = $_POST['name']; $age = $_POST['age']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $cell = $_POST['cell']; $ecnumber = $_POST['ecnumber']; $email_field = $_POST['email']; foreach($_POST['check'] as $value) { $check_msg .= "I am interested in: $value\n"; } //dance $yrsexp =$_POST['yrsexp']; $dexplain = $_POST['dexplain']; $tdexplore = $_POST['tdexplore']; //music $yrsexpMusic =$_POST['yrsexpMusic']; $mexplain =$_POST['mexplain']; $musicExplore=$_POST['musicExplore']; $insPlay=$_POST['insPlay']; $insLearn=$_POST['insLearn']; //acting $yrsexpAct=$_POST['yrsexpAct']; $actexplain=$_POST['actexplain']; $aexplore=$_POST['aexplore']; $aExploreW=$_POST['aExploreW']; $aExploreW2=$_POST['aExploreW2']; //education $gradeLevel=$_POST['gradeLevel']; $sdistrict=$_POST['sdistrict']; $cllisted=$_POST['cllisted']; $maother=$_POST['maother']; $dropdown = $_POST['drop_down']; $body = "From: $name_field\n Age: $age\n address: $address\n City: $city\n State: $state\n Zip: $zip\n Phone: $phone\n Cell: $cell\n Emergency Contact Number: $ecnumber\n E-Mail: $email_field\n $check_msg Option: $option\n ----------------------------------------------\n DANCE\n $yrsexp years experiance\n $dexplain\n i want to explore $tdexplore \n -----------------------------------------------\n MUSIC/n $yrsexpmusic years experiance\n $mexplain\n I would like to explore $musicExplore\n I play the $insPlay \n I want to learn $insLearn\n -----------------------------------------------\n ACTING\n $yrsexpAct years experiancen\n $actexplain\n i want to explore- $aexplore i have done- $aExploreW -thus far regarding theater\n the particular style that i want to explore is $aExploreW2\n -----------------------------------------------\n EDUCATION\n my grade current grade level is: $gradeLevel\n school district: $sdistrict\n Clubs and activities involved in: $cllisted\n they found the met by: $drop_down\n $maother\n"; if(trim($sname) == '') { $errmsg = 'Please enter your name'; } elseif(trim($email) == '') { $errmsg = 'Please enter your email address'; } elseif(!isEmail($email)) { $errmsg = 'Your email address is not valid'; } elseif(trim($age) == '') { $errmsg = 'Please enter your age'; } elseif(trim($address) == '') { $errmsg = 'Please enter your address'; } elseif(trim($city) == '') { $errmsg = 'Please enter your city'; } elseif(trim($state) == '') { $errmsg = 'Please enter your state'; } elseif(trim($zip) == '') { $errmsg = 'Please enter your zip'; } elseif(trim($phone) == '') { $errmsg = 'Please enter your phone number'; } elseif(trim($ecnnumber) == '') { $errmsg = 'Please enter your emergency contact number'; } elseif(trim($check_msg) == '') { $errmsg = 'Please tell us what your interested in'; } elseif(trim($drop_down) == '') { $errmsg = 'Please tell us how you found us'; } } if($errmsg == '') { if(get_magic_quotes_gpc()) { $subject = stripslashes($subject); } $to = "you@yourmom.com"; $subject = 'application from met website' . $subject ; } mail($to, $subject, $body); header('Location: nextstep.php'); exit; else { echo "error: $errmsg"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/ Share on other sites More sharing options...
akitchin Posted August 30, 2007 Share Posted August 30, 2007 it's probably because you're not in an if() block anymore once you hit the else statement. fix your closing braces towards the end of your script. Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337877 Share on other sites More sharing options...
ball420 Posted August 30, 2007 Author Share Posted August 30, 2007 sorry to sound like a retard but could you show me. thanks a mil Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337888 Share on other sites More sharing options...
akitchin Posted August 30, 2007 Share Posted August 30, 2007 i've commented your code to show you what i mean: <?php if($errmsg == '') // <-- open if # 1 { if(get_magic_quotes_gpc()) // <-- open if # 2 { $subject = stripslashes($subject); } // <-- close if # 2 $to = "you@yourmom.com"; $subject = 'application from met website' . $subject ; } // <-- close if # 1 // the following will run regardless of everything mail($to, $subject, $body); header('Location: nextstep.php'); exit; else { // <-- else pertains to no currently open if block, as they were both closed upstairs echo "error: $errmsg"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337893 Share on other sites More sharing options...
ball420 Posted August 30, 2007 Author Share Posted August 30, 2007 i think i screwed this up cuase i'm getting an error on line 174 which is right above the if($errmsg but here it is please bear with me i'm a newbie trying to understand if($errmsg == '') { if(get_magic_quotes_gpc()) } { $subject = stripslashes($subject); $to = "amolaee@jbn.com"; $subject = 'application from met website' . $subject ; } mail($to, $subject, $body); header('Location: nextstep.php'); else { echo "error: $errmsg"; } } exit; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337922 Share on other sites More sharing options...
Jessica Posted August 30, 2007 Share Posted August 30, 2007 If the error is on a line above that code why didn't you post the code it is referring to? We can't help with code we can't see.. Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337924 Share on other sites More sharing options...
ball420 Posted August 30, 2007 Author Share Posted August 30, 2007 here it is sorry <?php if(isset($_POST['submit'])) { $errmsg = ''; // error message $nextstep = "nextstep.php"; $name_field = $_POST['name']; $age = $_POST['age']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $cell = $_POST['cell']; $ecnumber = $_POST['ecnumber']; $email_field = $_POST['email']; foreach($_POST['check'] as $value) { $check_msg .= "I am interested in: $value\n"; } //dance $yrsexp =$_POST['yrsexp']; $dexplain = $_POST['dexplain']; $tdexplore = $_POST['tdexplore']; //music $yrsexpMusic =$_POST['yrsexpMusic']; $mexplain =$_POST['mexplain']; $musicExplore=$_POST['musicExplore']; $insPlay=$_POST['insPlay']; $insLearn=$_POST['insLearn']; //acting $yrsexpAct=$_POST['yrsexpAct']; $actexplain=$_POST['actexplain']; $aexplore=$_POST['aexplore']; $aExploreW=$_POST['aExploreW']; $aExploreW2=$_POST['aExploreW2']; //education $gradeLevel=$_POST['gradeLevel']; $sdistrict=$_POST['sdistrict']; $cllisted=$_POST['cllisted']; $maother=$_POST['maother']; $dropdown = $_POST['drop_down']; $body = "From: $name_field\n Age: $age\n address: $address\n City: $city\n State: $state\n Zip: $zip\n Phone: $phone\n Cell: $cell\n Emergency Contact Number: $ecnumber\n E-Mail: $email_field\n $check_msg Option: $option\n ----------------------------------------------\n DANCE\n $yrsexp years experiance\n $dexplain\n i want to explore $tdexplore \n -----------------------------------------------\n MUSIC/n $yrsexpmusic years experiance\n $mexplain\n I would like to explore $musicExplore\n I play the $insPlay \n I want to learn $insLearn\n -----------------------------------------------\n ACTING\n $yrsexpAct years experiancen\n $actexplain\n i want to explore- $aexplore i have done- $aExploreW -thus far regarding theater\n the particular style that i want to explore is $aExploreW2\n -----------------------------------------------\n EDUCATION\n my grade current grade level is: $gradeLevel\n school district: $sdistrict\n Clubs and activities involved in: $cllisted\n they found the met by: $drop_down\n $maother\n"; if(trim($sname) == '') { $errmsg = 'Please enter your name'; } elseif(trim($email) == '') { $errmsg = 'Please enter your email address'; } elseif(!isEmail($email)) { $errmsg = 'Your email address is not valid'; } elseif(trim($age) == '') { $errmsg = 'Please enter your age'; } elseif(trim($address) == '') { $errmsg = 'Please enter your address'; } elseif(trim($city) == '') { $errmsg = 'Please enter your city'; } elseif(trim($state) == '') { $errmsg = 'Please enter your state'; } elseif(trim($zip) == '') { $errmsg = 'Please enter your zip'; } elseif(trim($phone) == '') { $errmsg = 'Please enter your phone number'; } elseif(trim($ecnnumber) == '') { $errmsg = 'Please enter your emergency contact number'; } elseif(trim($check_msg) == '') { $errmsg = 'Please tell us what your interested in'; } elseif(trim($drop_down) == '') { $errmsg = 'Please tell us how you found us'; } } if($errmsg == '') { if(get_magic_quotes_gpc()) } { $subject = stripslashes($subject); $to = "amolaee@jbn.com"; $subject = 'application from met website' . $subject ; } mail($to, $subject, $body); header('Location: nextstep.php'); else { echo "error: $errmsg"; } } exit; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337948 Share on other sites More sharing options...
Jessica Posted August 30, 2007 Share Posted August 30, 2007 You have what appears to be an extra } on that line. Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337954 Share on other sites More sharing options...
ball420 Posted August 30, 2007 Author Share Posted August 30, 2007 now it's 178i knew i screwed that bottom up some how please help.. 178 is under my getmagicquotes if($errmsg == '') { if(get_magic_quotes_gpc()) } { $subject = stripslashes($subject); $to = "amolaee@jbn.com"; $subject = 'application from met website' . $subject ; } mail($to, $subject, $body); header('Location: nextstep.php'); else { echo "error: $errmsg"; } } exit; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337959 Share on other sites More sharing options...
Jessica Posted August 30, 2007 Share Posted August 30, 2007 Don't you see it? I mean...it's pretty obvious that you have an errant } right there. Are you looking at the code or just posting it here and asking us to fix it? Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337962 Share on other sites More sharing options...
ball420 Posted August 30, 2007 Author Share Posted August 30, 2007 i'm trying to understand again i'm sorry i have been so confused i thought i could get help. i moved it to above my exit; and it now goes through but i says enter your name when the name is actully there??? i'm not asking you to do it i'm asking to get some knowlege so that i know what i doing in the future thanks again for the help Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337971 Share on other sites More sharing options...
Jessica Posted August 30, 2007 Share Posted August 30, 2007 I'm not sure where its supposed to be - you need to indent your code and then you'll figure out where it goes. Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337974 Share on other sites More sharing options...
ball420 Posted August 30, 2007 Author Share Posted August 30, 2007 i'm don't get what your saying??? basically now the filter isn't working thanks again <?php if(isset($_POST['submit'])) { $errmsg = ''; // error message $nextstep = "nextstep.php"; $name_field = $_POST['name']; $age = $_POST['age']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $cell = $_POST['cell']; $ecnumber = $_POST['ecnumber']; $email_field = $_POST['email']; foreach($_POST['check'] as $value) { $check_msg .= "I am interested in: $value\n"; } //dance $yrsexp =$_POST['yrsexp']; $dexplain = $_POST['dexplain']; $tdexplore = $_POST['tdexplore']; //music $yrsexpMusic =$_POST['yrsexpMusic']; $mexplain =$_POST['mexplain']; $musicExplore=$_POST['musicExplore']; $insPlay=$_POST['insPlay']; $insLearn=$_POST['insLearn']; //acting $yrsexpAct=$_POST['yrsexpAct']; $actexplain=$_POST['actexplain']; $aexplore=$_POST['aexplore']; $aExploreW=$_POST['aExploreW']; $aExploreW2=$_POST['aExploreW2']; //education $gradeLevel=$_POST['gradeLevel']; $sdistrict=$_POST['sdistrict']; $cllisted=$_POST['cllisted']; $maother=$_POST['maother']; $dropdown = $_POST['drop_down']; $body = "From: $name_field\n Age: $age\n address: $address\n City: $city\n State: $state\n Zip: $zip\n Phone: $phone\n Cell: $cell\n Emergency Contact Number: $ecnumber\n E-Mail: $email_field\n $check_msg Option: $option\n ----------------------------------------------\n DANCE\n $yrsexp years experiance\n $dexplain\n i want to explore $tdexplore \n -----------------------------------------------\n MUSIC/n $yrsexpmusic years experiance\n $mexplain\n I would like to explore $musicExplore\n I play the $insPlay \n I want to learn $insLearn\n -----------------------------------------------\n ACTING\n $yrsexpAct years experiancen\n $actexplain\n i want to explore- $aexplore i have done- $aExploreW -thus far regarding theater\n the particular style that i want to explore is $aExploreW2\n -----------------------------------------------\n EDUCATION\n my grade current grade level is: $gradeLevel\n school district: $sdistrict\n Clubs and activities involved in: $cllisted\n they found the met by: $drop_down\n $maother\n"; if(trim($sname_field) == '') { $errmsg = 'Please enter your name'; } elseif(trim($email) == '') { $errmsg = 'Please enter your email address'; } elseif(!isEmail($email)) { $errmsg = 'Your email address is not valid'; } elseif(trim($age) == '') { $errmsg = 'Please enter your age'; } elseif(trim($address) == '') { $errmsg = 'Please enter your address'; } elseif(trim($city) == '') { $errmsg = 'Please enter your city'; } elseif(trim($state) == '') { $errmsg = 'Please enter your state'; } elseif(trim($zip) == '') { $errmsg = 'Please enter your zip'; } elseif(trim($phone) == '') { $errmsg = 'Please enter your phone number'; } elseif(trim($ecnnumber) == '') { $errmsg = 'Please enter your emergency contact number'; } elseif(trim($check_msg) == '') { $errmsg = 'Please tell us what your interested in'; } elseif(trim($drop_down) == '') { $errmsg = 'Please tell us how you found us'; } if($errmsg == '') { if(get_magic_quotes_gpc()) { $subject = stripslashes($subject); $to = "amolaee@jbn.com"; $subject = 'application from met website' . $subject ; } mail($to, $subject, $body); header('Location: nextstep.php'); } else { echo "error: $errmsg"; } } exit; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337978 Share on other sites More sharing options...
darkfreaks Posted August 30, 2007 Share Posted August 30, 2007 Try This: <?php if(trim($sname_field) == '') { $errmsg = 'Please enter your name'; } elseif(trim($email) == '') { $errmsg = 'Please enter your email address'; } elseif(!isEmail($email)) { $errmsg = 'Your email address is not valid'; } elseif(trim($age) == '') { $errmsg = 'Please enter your age'; } elseif(trim($address) == '') { $errmsg = 'Please enter your address'; } elseif(trim($city) == '') { $errmsg = 'Please enter your city'; } elseif(trim($state) == '') { $errmsg = 'Please enter your state'; } elseif(trim($zip) == '') { $errmsg = 'Please enter your zip'; } elseif(trim($phone) == '') { $errmsg = 'Please enter your phone number'; } elseif(trim($ecnnumber) == '') { $errmsg = 'Please enter your emergency contact number'; } elseif(trim($check_msg) == '') { $errmsg = 'Please tell us what your interested in'; } elseif(trim($drop_down) == '') { $errmsg = 'Please tell us how you found us'; } if($errmsg == '') { if(get_magic_quotes_gpc()) { $subject = stripslashes($subject); $to = "amolaee@jbn.com"; $subject = 'application from met website' . $subject ; } mail($to, $subject, $body); header('Location: nextstep.php'); } else { echo "error: $errmsg"; } exit; ?> Also i recomend downloading Jedit it is helpful with syntax errors not to be prudent but jesirose was right you had an extra } before your exit; line are you this ignorant? try looking harder next time. Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-337989 Share on other sites More sharing options...
Jessica Posted August 30, 2007 Share Posted August 30, 2007 Textpad is also good for PHP, with color coding and indentation. Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-338035 Share on other sites More sharing options...
darkfreaks Posted August 30, 2007 Share Posted August 30, 2007 Jedit also has color coding and and line numbering and it tells ya if your missing syntax *nod* Quote Link to comment https://forums.phpfreaks.com/topic/67349-form-not-validating-or-sendingplease-help/#findComment-338039 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.