PHP表单格式Echo语句输出
我正在做一份php5表格。 以下是功能代码:PHP表单格式Echo语句输出,php,html,forms,Php,Html,Forms,我正在做一份php5表格。 以下是功能代码: 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
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();
}
函数失效($error){
//您的错误代码可以转到这里
echo“非常抱歉,您提交的表单有错误。
这些错误如下所示。
”;
回声“
”;
echo$错误。“
”;
echo“请返回并修复这些错误。
”;
模具();
}
第一个和第三个echo语句输出html格式,但是如何让中间的$error语句输出漂亮的html呢 试试这个:
<?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();
}
?>
这样做:
echo "<div style ='background-color:red;'>".$error."</div>"
echo.“$error”