2013-03-21 4 views
0

이 PHP 파일은 올바로 표시되지만 '예상치 못한 파일 끝내기'오류가 반환됩니다. 오류가 html 파일의 어딘가에 있습니다. ""안에 인쇄 태그를 넣으려고했는데, php 줄에 하나의 여분의 공백을 제거하고 변수 줄에 대괄호 []와 따옴표 ''사이에 공백을 추가했습니다. 그리고 Enter 키를 누르면 여전히 같은 오류가 있습니다. 데이터를 PHP 스크립트로 보냅니다. 대신이의 http://pastebin.com/Rb62pZcy피드백 양식 HTML 예기치 않은 파일 끝 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" xml:lang="en" lang="en"> 
<head> 
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<title>Your Feedback</title> 
</head> 
<body> 
<?php // Script 3.3 handle_form.php 
// This page receives the data from feedback.html 
// It will receive: title, name, email, comments in $_POST 

$title = $_POST [ 'title' ] ; 
$name = $_POST [ 'name' ] ; 
$email = $_POST [ 'email' ] ; 
$comments = $_POST [ 'comments' ] ; 

print "<p>Thank you, $title $name, for your comments.</p>" 
"<p>You stated that you found this example to be '$response' and added:<br />$comments</p>" 

?> 
</body> 

답변

0

:

print "<p>Thank you, $title $name, for your comments.</p>" 
"<p>You stated that you found this example to be '$response' and added:<br />$comments</p>" 

사용이 다음은 html 코드입니다

echo "<p>Thank you, $title $name, for your comments.</p>"; 
echo "<p>You stated that you found this example to be '$response' and added:<br />$comments</p>"; 

난 당신이 그리워 생각은 ";" 캐릭터.

------------------ 업데이트 --------------------------- -

이 코드를 시도하고 작동합니다

<!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" xml:lang="en" lang="en"> 
    <head> 
    <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
    <title>Your Feedback</title> 
    </head> 
    <body> 
    <?php 

    if (isset($_POST['email'])){ 
    $title = $_POST['title']; 
    $name = $_POST['name']; 
    $email = $_POST['email']; 
    $comments = $_POST['comments']; 
    } 
    else 
    { 
    $title = "No title arrived"; 
    $name = "No name arrived"; 
    $comments = "No comments arrived"; 
    } 

    //$response is not defined?? 
    $response = "Live long and prosper"; 
    //so i defined 

    echo "<p>Thank you, $title $name, for your comments.</p>"; 
    echo "<p>You stated that you found this example to be '$response' and added:<br />$comments</p>"; 
    ?> 
    </body> 

    </html> 

추신 : 혼자 스크립트를 실행하려고 ... 이름을 "handle_form.php을"및 탐색 주소 표시 줄에 넣고 :

localhost/your_project/handle_form.php 

내 로컬 호스트에서 작동합니다 ..... 문제가 계속 될 경우 제출 페이지에 문제가있을 수 있습니다.

살루 도스.

+0

감사합니다. 나는 당신이 제안한 것을 시도했고, 같은 오류를주고있다. –