<?php

define("ContactEmail", "highwebgeeta@gmail.com");
$error_msg = 'The following fields were left empty or contain invalid information:<ul>'; 
    $error = false;
	
	 $submit = $_POST['submit']; 
    if (empty($submit))  
        $form_submitted = false; 
    else 
      $form_submitted = true; 

  if ($form_submitted) { 
   $title = $_POST['title']; 
        $name = $_POST['name']; 
        $lname = $_POST['lname']; 
        $address = $_POST['address']; 
        $pin = $_POST['pin']; 
        $country = $_POST['country']; 
		$contact = $_POST['contact']; 
		$email = $_POST['email']; 
         
		 if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; } 
        if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; } 
        if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; } 
       if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$",  $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }} 
        $error_msg .= "</ul>"; 
		
		 if (!$error) { 
     
            $msg  = "Full Name: \t $name \n"; 
            $msg .= "Contact: \t $contact \n"; 
            $msg .= "E-mail Address: \t $email \n"; 
            $msg .= "address: \n---\n $address \n---\n";
			
			$mailheaders  = "Enquiry"; 
            $mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n"; 
            $mailheaders .= "From: $name <$email>\r\n"; 
            $mailheaders .= "Reply-To: $name <$email>\r\n";  
			
			 mail(ContactEmail,  $subject , stripslashes($msg),  $mailheaders); 
        } 
    }  
?> 

<?php 
                // email was successfully send 
                if (($form_submitted) && (!$error)) { 
            ?> 
            <!-- display submitted data --> 
            Thank you for your feedback,  <?php echo $name; ?>. 
            This is the information you submitted:<br><br><?php echo nl2br(stripslashes($msg)); ?>

i create a contact form that link to 5 pages , please help me to create a contact form using php..

i create a contact form that link to 5 pages , please help me to create a contact form using php..

Well what seems to be the problem. Does it not function properly or are the errors reported. If so, what are the errors reported.
Also I noticed your mail function is incorrect and needs to be as follows:

mail("ContactEmail", $subject , stripslashes($msg), $mailheaders);

Parse error: syntax error, unexpected $end in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 61

Parse error: syntax error, unexpected $end in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 61


this error occurs...

Parse error: syntax error, unexpected $end in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 61
this error occurs...

Unequal number of left and right braces.

<?php

define("ContactEmail", "your-email");
$error_msg = 'The following fields were left empty or contain invalid information:<ul>'; 
    $error = false;
	
	 $submit = $_POST['submit']; 
    if (empty($submit))  
        $form_submitted = false; 
    else 
      $form_submitted = true; 

  if ($form_submitted) { 
   $title = $_POST['title']; 
        $name = $_POST['name']; 
        $lname = $_POST['lname']; 
        $address = $_POST['address']; 
        $pin = $_POST['pin']; 
        $country = $_POST['country']; 
		$contact = $_POST['contact']; 
		$email = $_POST['email']; 
         
		 if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; } 
        if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; } 
        if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; } 
       if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$",  $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }} 
        $error_msg .= "</ul>"; 
		
		 if (!$error) { 
     
            $msg  = "Full Name: \t $name \n"; 
            $msg .= "Contact: \t $contact \n"; 
            $msg .= "E-mail Address: \t $email \n"; 
            $msg .= "address: \n---\n $address \n---\n";
			
			$mailheaders  = "Enquiry"; 
            $mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n"; 
            $mailheaders .= "From: $name <$email>\r\n"; 
            $mailheaders .= "Reply-To: $name <$email>\r\n";  
			
			mail("your-email", $subject , stripslashes($msg), $mailheaders);
    }  
?> 

<?php 
                // email was successfully send 
                if (($form_submitted) && (!$error)) { 
            ?> 
            <!-- display submitted data --> 
            Thank you for your feedback,  <?php echo $name; ?>. 
            This is the information you submitted:<br><br><?php echo nl2br(stripslashes($msg)); ?>

Parse error: syntax error, unexpected $end in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 61

Hi ..

you have to close one if condition at last..

}

I just checked you script for what line is 61 and your script only goes to line 52. Could you post from lines 50 to 62 so I can see what needs fixing?

<?php

define("ContactEmail", "highwebgeeta@gmail.com");
$error_msg = 'The following fields were left empty or contain invalid information:<ul>'; 
    $error = false;
	
	 $submit = $_POST['submit']; 
    if (empty($submit))  
        $form_submitted = false; 
    else 
      $form_submitted = true; 

  if ($form_submitted) { 
   $title = $_POST['title']; 
        $name = $_POST['name']; 
        $lname = $_POST['lname']; 
        $address = $_POST['address']; 
        $pin = $_POST['pin']; 
        $country = $_POST['country']; 
		$contact = $_POST['contact']; 
		$email = $_POST['email']; 
         
		 if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; } 
        if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; } 
        if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; } 
       if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$",  $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }} 
        $error_msg .= "</ul>"; 
		
		 if (!$error) { 
     
            $msg  = "Full Name: \t $name \n"; 
            $msg .= "Contact: \t $contact \n"; 
            $msg .= "E-mail Address: \t $email \n"; 
            $msg .= "address: \n---\n $address \n---\n";
			
			$mailheaders  = "Enquiry"; 
            $mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n"; 
            $mailheaders .= "From: $name <$email>\r\n"; 
            $mailheaders .= "Reply-To: $name <$email>\r\n";  
			
			mail("highwebgeeta@gmail.com", $subject , stripslashes($msg), $mailheaders);
    }  
?> 

<?php 
                // email was successfully send 
                if (($form_submitted) && (!$error)) { 
            ?> 
            <!-- display submitted data --> 
            Thank you for your feedback,  <?php echo $name; ?>. 
            This is the information you submitted:<br><br><?php echo nl2br(stripslashes($msg));
			 ?>

Hi ..

you have to close one if condition at last..

}

i did bt nothing happened.. same error

hi...

try to use this code instead of ur code.....i made some small changes....

<?php

define("ContactEmail", "highwebgeeta@gmail.com");
$error_msg = 'The following fields were left empty or contain invalid information:<ul>';
$error = false;

$submit = $_POST['submit'];
if (empty($submit))
{
$form_submitted = false;
}
else{
$form_submitted = true;
}
if ($form_submitted) {
$title = $_POST['title'];
$name = $_POST['name'];
$lname = $_POST['lname'];
$address = $_POST['address'];
$pin = $_POST['pin'];
$country = $_POST['country'];
$contact = $_POST['contact'];
$email = $_POST['email'];

if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; }
if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; }
if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; }
if($email) { 
if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email))
{ 
$error_msg .= "<li>E-mail Address</li>"; $error = true;
 }
 }
$error_msg .= "</ul>";

if (!$error) {

$msg = "Full Name: \t $name \n";
$msg .= "Contact: \t $contact \n";
$msg .= "E-mail Address: \t $email \n";
$msg .= "address: \n---\n $address \n---\n";

$mailheaders = "Enquiry";
$mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$mailheaders .= "From: $name <$email>\r\n";
$mailheaders .= "Reply-To: $name <$email>\r\n";

mail("highwebgeeta@gmail.com", $subject , stripslashes($msg), $mailheaders);
}

// email was successfully send
if ((isset($form_submitted)) && (!$error)) {
?>
<!-- display submitted data -->
Thank you for your feedback, <?php echo $name; ?>.
This is the information you submitted:<br><br>
<?php echo nl2br(stripslashes($msg));  }?>

FOUND IT (i think)

Try making the following your code as you missed the last closing bracket on the last line.

<?php

define("ContactEmail", "highwebgeeta@gmail.com");
$error_msg = 'The following fields were left empty or contain invalid information:<ul>'; 
$error = false;

$submit = $_POST['submit']; 
if (empty($submit)) 
$form_submitted = false; 
else 
$form_submitted = true; 

if ($form_submitted) { 
$title = $_POST['title']; 
$name = $_POST['name']; 
$lname = $_POST['lname']; 
$address = $_POST['address']; 
$pin = $_POST['pin']; 
$country = $_POST['country']; 
$contact = $_POST['contact']; 
$email = $_POST['email']; 

if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; } 
if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; } 
if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; } 
if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }} 
$error_msg .= "</ul>"; 

if (!$error) { 

$msg = "Full Name: \t $name \n"; 
$msg .= "Contact: \t $contact \n"; 
$msg .= "E-mail Address: \t $email \n"; 
$msg .= "address: \n---\n $address \n---\n";

$mailheaders = "Enquiry"; 
$mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n"; 
$mailheaders .= "From: $name <$email>\r\n"; 
$mailheaders .= "Reply-To: $name <$email>\r\n"; 

mail("highwebgeeta@gmail.com", $subject , stripslashes($msg), $mailheaders);
} 
?> 

<?php 
// email was successfully send 
if (($form_submitted) && (!$error)) { 
?> 
<!-- display submitted data --> 
Thank you for your feedback, <?php echo $name; ?>. 
This is the information you submitted:<br><br><?php echo nl2br(stripslashes($msg));
} ?>

Parse error: syntax error, unexpected $end in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 121

i cahnged my code to ur code showing the above error....:-(

Parse error: syntax error, unexpected $end in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 60

Parse error: syntax error, unexpected $end in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 121

i cahnged my code to ur code showing the above error....:-(

hi try to this..i think its right..

<?php echo nl2br(stripslashes($msg));  }}?>

hey i tried this now showing this error

Notice: Undefined index: submit in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 14

hey i tried this now showing this error

Notice: Undefined index: submit in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 14

hey i tried this now showing this error

Notice: Undefined index: submit in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\requirements-form\mail.php on line 14

Can u send me ur full code.....

FYI, Notice is not an error and can be turned off with different Error reporting values..

Edit: It is kind of an error, but can be ignored. (Doh!)

I agree. It is only commercial code that you need to worry about the notice errors. So place the following at the top of your file:

error_reporting(E_ALL ^ E_NOTICE);
This article has been dead for over six months. Start a new discussion instead.