Jump to content

form not validating or sending..please help


ball420

Recommended Posts

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";
}

} 
?>


Link to comment
Share on other sites

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";
}

} 
?>

Link to comment
Share on other sites

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; 
?>

Link to comment
Share on other sites

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; 
?>


Link to comment
Share on other sites

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; 
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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; 
?>


Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.