PHP表单提交打开空白页面

I copied the code for a form to my website. It doesn't submit... Can someone see the problem?

<?php
if(isset($_POST['email'])) {

// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "danielko@intrahouse.co.il";
$email_subject = "פנייה מהאתר";


function died($error) {
    // your error code can go here
    echo "We are very sorry, but there were error(s) found with the form you submitted. ";
    echo "These errors appear below.<br /><br />";
    echo $error."<br /><br />";
    echo " מלא את כל הפרטים בבקשה.<br /><br />";
    die();
}

  // validation expected data exists
  if(!isset($_POST['name']) ||
    !isset($_POST['email']) ||
    !isset($_POST['telephone']) ||
    !isset($_POST['comments'])) {
    died(' אחד הפרטים חסר. מלא את כל הפרטים בבקשה');       
}

$first_name = $_POST['first_name']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$comments = $_POST['comments']; // required

$error_message = "נא מלא פרטים נכונים";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'נא מלא פרטים נכונים.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
 $email_message = "Form details below.

";

function clean_string($string) {
  $bad = array("content-type","bcc:","to:","cc:","href");
  return str_replace($bad,"",$string);
}

$email_message .= "Name: ".clean_string($first_name)."
";
$email_message .= "Email: ".clean_string($email_from)."
";
$email_message .= "Telephone: ".clean_string($telephone)."
";
$email_message .= "Comments: ".clean_string($comments)."
";


// create email headers
$headers = 'From: '.$email_from."
".
'Reply-To: '.$email_from."
" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
?>





<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" dir"=rtl">
<meta name="keywords" content="פורום בית חכם,בית חכם, חשמל חכם, בקרת חשמל, ניהול חשמל,     חסכון בחשמל, אמצעי בקרת חשמל, כמה עולה בית חכם, מחירי חשמל חכם, מערכות בית חכם, תכנון בית חכם">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="stylesheet" href="contact_style.css" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"    type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.uniform.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(e){
$("input:checkbox, input:radio").uniform();
$('#top').css('float','none');
$('.content_window').css('height','auto');
});
</script>
<title>IntraHouse - צור קשר</title>

</head>

<body>
<div class="background">
<div class="content_window">
<header>
<div class="languages">
        <a href="indexEnglish.html">English</a>
        <a href="index.html">עברית</a>
    </div>
<div id="app_theme" style="margin-top:3px" ></div>
    <div id="top" style="margin-top:2px" style="float:none" >
        <nav id="topmenu">
            <ul>
                <li id="home"><a href="index.html">דף הבית </a></li>
                <li id="about"><a href="#">אודות </a></li>
                <li id="prices"><a href="prices.html">מחירים</a></li>
                <li id="projects"><a href="projects.html">פרוייקטים</a></li>
                <li id="store"><a href="store.html">חנות</a></li>
                <li id="contact_us"><a href="contact_us.html">צור קשר</a></li>            
            </ul>
        </nav>
    </div>
</header>
<div class="contact" style="margin-top:10px">
<article dir="rtl">
<h1 style="margin-top:10px"> נשמע מעניין? השאירו פרטים ונחזור אליכם</h1>
<form>
<ul>
    <li>
        <label for="name"> שם: </label>
        <input type="text" size="40" id="name" />
    </li>
    <li>
        <label for="telephone"> טלפון: </label>
        <input type="text" size="40" id="name" />
    </li>
    <li>
        <label for="email"> כתובת אימייל: </label>
        <input type="email" size="40" id="email" />
    </li>  

    </li>     
        <li>
        <label for="message">תוכן ההודעה:</label>
        <textarea cols="50" rows="5" id="message"></textarea>
    </li>
</ul>
<p>
    <button type="reset" class="right"> אפס </button>
    <button type="submit" class="action"> שלח </button>

</p>
</form>
</article>

</div>
</div>
</body>
</html>

<?php
}
?>

HTML appears at the end, as you can see. All buttons work and email @ check work, but the form submmision just opens an empty page.

Your form has no method or action I believe this doesn't work in some browsers.

Change

<form>

To:

<form method="post" action="[the url of the page]">

The default method for a form is GET so if you don't specify it in the form tag, you would need $_GET instead of $_POST.

You also need an action attibute, so your tag should look like:

<form action="" method="post">

Then you would also need to add name attributes to all your form fields as that is what gets sent to the server, not the id.

Here are two crucial problems. The id of an HTML element needs to be unique, so here you have two elements with the same id:

<li>
    <label for="name"> שם: </label>
    <input type="text" size="40" id="name" />
</li>
<li>
    <label for="telephone"> טלפון: </label>
    <input type="text" size="40" id="name" />
</li>

This needs to change, and also each element needs a name attribute, or it will not appear in the POST array properly:

<li>
    <label for="name"> שם: </label>
    <input type="text" size="40" id="name" name="name" />
</li>
<li>
    <label for="telephone"> טלפון: </label>
    <input type="text" size="40" id="telephone" name="telephone" />
</li>

Etc. - all element must have a name and a unique id. In particular, your email field needs name="email" so that your if(isset($_POST['email'])) check at the beginning of the script will work. Also, the form needs the method POST in order for those elements to pass into the POST array. If you simply omit the action, the form will submit to the same page:

<form method="POST">

your <form> should have method="POST" attribute like this :

<form method="POST">

You have errors :

<input type="email" size="40" id="email" />

it should be

<input type="text" size="40" id="email" name="email" />

See, you have $_POST['first_name'] in your code, so you must have <input type="text" name="first_name" /> , a name attribute is a must.

in order to get the value of an input field in php you have to use name attribute