2014-01-23 3 views
-1

나는 php5 폼으로 작업 중이다. 다음은 기능 코드입니다 :PHP 폼 - 포맷 에코 문 출력

function died($error) { 

     // your error code can go here 

     echo "<div style ='background-color:green;font:22px Arial,tahoma,sans-serif;color:#ff0000'>We are very sorry, but there were error(s) found with the form you submitted.<br /><br /> 
These errors appear below.<br /><br /></div>"; 

     echo "<br /><br />"; 
     echo $error."<br /><br />"; 

     echo "<div style ='background-color:green;font:22px Arial,tahoma,sans-serif;color:#ff0000'>Please go back and fix these errors.<br /><br /></div>"; 

     die(); 

    } 

첫 번째와 세 번째 echo 문 출력 html 형식,하지만 어떻게 내가 출력 꽤 HTML로 중간 $ 오류 문을 얻을 수 있습니까?

답변

0

이 시도 :이 같은

<?php 

function died($error) { 
echo <<< EOF 
<div style ='background-color:green;font:22px Arial,tahoma,sans-serif;color:#ff0000'>We are very sorry, but there were error(s) found with the form you submitted.<br /><br /> 
These errors appear below.<br /><br /></div> 
<br /><br /> 
$error.<br /><br /> 
<div style ='background-color:green;font:22px Arial,tahoma,sans-serif;color:#ff0000'>Please go back and fix these errors.<br /><br /></div> 
EOF; 
die(); 
} 

?> 
1

soemthing :

echo "<div style ='background-color:red;'>".$error."</div>"