Why I am not connecting to sendmail.php?

I need someone to show me what is it that I am doing wrong in the following code snippets. Of course both files are on remote server…
You can access index.html by typing bghodsi.com/vb_site/.

Below is a part of coding in html contact form
:

<div><form action="sendmail.php" method="post"> 
 <div class="nlabel">Full Name</div>
 <div><input type="text" id="fullname" name="fullname" class="text_style" ></div>
 <div class="nlabel">Email Address</div>
 <div><input type="text" id="email" name="email" class="text_style"></div>
 <div class="nlabel">Telephone</div>
 <div><input type="text" id="telephone" name="telephone" class="text_style"></div>
 <div class="nlabel">Comments</div>
 <div ><textarea cols="37" rows="11" id="comments" name="comments"></textarea></div>
 <div id="button_style"><input type="image" src="images/container_form_button.png" name="submitted" border="0" alt="submit" /></div>
</form></div>

============================================================================================================

below is sendmail.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Emailing Form Data</title>
<style type="text/css">
code {color:#F00C4D;font-weight:bold;font-size:1.2em}
i {color: #6D0CF0}

.error { color: red; }
</style>
</head>
<body>

    <?php
   $redirectTo = "http://www.bghodsi.com";
    $to = "********";
   $from = "********";
   $subject = "Contact Form Submission";
    $headers = "From: $from\\r\
";
  
   $message = "";
   $formFields = array_keys($_POST);
  
   for ($i = 0; $i < sizeof($formFields); $i++)
   {
       $theField = strip_tags($formFields[$i]);
       $theValue = strip_tags($_POST[$theField]);
       $message .= $theField;
       $message .= " = ";
       $message .= $theValue;
       $message .= "\
";
   }
 // Check if the form has been submitted
if (isset($_POST['submitted'])) {

	 $problem = FALSE ;// No problems so far.
	 
// Check for each field
	 
	      if (empty($_POST['fullname'])) {
	 		$problem = TRUE; 
			}
			if (empty($_POST['email'])) {
	 		$problem = TRUE;
			}
			if (empty($_POST['telephone'])) {
	 		$problem = TRUE;
			}
			if (empty($_POST['comments'])) {
	 		$problem = TRUE;
			}
 if  ($problem)
{
      include("oops.html");
        exit;
}
else {     
				  $success = mail($to, $subject, $message, $headers); 
   include("thanks.html");
}
}   ?>

</body>
</html>

Move all php above <html> or better yet remove all html from this page.
Instead of using include(); use

header("location: oops.html");
exit; 

(You already have opening html and body tags so including another page within this is the wrong approach.)
Get rid of

$success = 

… and just call

mail($to, $subject, $message, $headers);
header("location: thanks.html");
exit;

But just because $problem hasn’t been flagged as TRUE doesn’t mean mail was successfully sent but these steps should get you closer.

Hi Drummin:

Thanks for your suggestions regarding php coding.
The reason I was unable to connect to php file was because of one line of coding in my html file. When I change it to standard html button all works well.
<div id=“button_style”><input type=“image” src=“images/container_form_button.png” name=“submitted” border=“0” alt=“submit” /></div> <<<======== Line causing the problem

<div id=“button_style”><input type=“submit” name=“submitted” id=“submitted” value=“Submit:” ></div><========= Line that fixed the problem.

Why my original line of coding does not work. Your input will be greatly appreciated.

Bob Ghodsi