如何在html之前显示php代码
我有一个简单的问题,基本上我已经写了一些代码,我已经写了一些php代码,在html之前显示代码,在html之后显示代码,然后是页脚…问题是html首先显示,然后是页脚,然后是表。。 我想先显示表格,然后显示html,再显示页脚。。 这是我的密码如何在html之前显示php代码,php,Php,我有一个简单的问题,基本上我已经写了一些代码,我已经写了一些php代码,在html之前显示代码,在html之后显示代码,然后是页脚…问题是html首先显示,然后是页脚,然后是表。。 我想先显示表格,然后显示html,再显示页脚。。 这是我的密码 if($orderCount == 0){ echo "<p><strong> No orders pending. Please try again later.</strong></p>"; } e
if($orderCount == 0){
echo "<p><strong> No orders pending. Please try again later.</strong></p>";
}
echo "<table border=\"1\">\n"echo "<tr> <th bgcolor=\"blue\"> Order Summary</th></tr>
<tr> <th bgcolor=\"blue\"> Title</th>
<th bgcolor=\"blue\"> Author</th>
<th bgcolor=\"blue\"> Format</th>
<th bgcolor=\"blue\"> Price</th>
</tr>";
for($i=0;$i<$orderCount;$i++){
echo "<tr>
<td> $titleArray[$i]</td>
<td>$authorArray[$i]</td>
<td>$formatArray[$i]</td>
<td> $$priceArray[$i]</td>
</tr>";
}
$total = number_format(array_sum($priceArray),2);
echo " <tr> <td bgcolor=\"blue\"> Total price</td><td> </td> <td> </td><td align=\"right\">$$total</td></tr>"
?>
<form action="myform.php" method="post">
<ul>
<li>Payment Information</li>
</ul>
<label for="customer name">Customer Name</label>
<input type="text" name="customername" id="customername"> <br />
<label for="address">Street Address</label>
<input type="text" name="city" id="city"> <br />
<label for="state">State</label>
<input type="text" name="state" id="state"> <br />
<label for="zip">Zip Code</label>
<input type="text" name="zip" id="zip"> <br />
<input type="submit" value="Confirm Order">
</form>
</body>
if($orderCount==0){
echo“没有未决订单。请稍后再试。”;
}
echo“\n”echo“订单摘要
标题
作者
格式
价格
";
对于($i=0;$i)
- 付款信息
客户名称
街道地址
陈述
邮政编码
您应该使用函数。您应该使用函数。您可以使用php,然后像这样使用html
<?php
// some php code you had
?>
your html
<?php
// resume php code
?>
你的html
您只需使用php,然后像这样编写html即可
<?php
// some php code you had
?>
your html
<?php
// resume php code
?>
你的html
如果您在完成后关闭表格标记
,效果可能会更好……并且在打印第一个标题后关闭表格行
。您确实需要检查打开和关闭标记……您还有一堆双美元符号,如$$total
。这是故意的吗?您应该是真的请尝试更好地组织您的代码,并查看它以尝试捕获所有错误。实际上,只需关闭表标记即可工作…谢谢如果您在完成后关闭表标记
,它可能会工作得更好…并且在打印完第一个标题后关闭表行
。您确实需要检查打开的行还有关闭标签……你也有一堆双美元符号,比如$$total
。这是故意的吗?你真的应该尝试更好地构建代码,并通过查看代码来尝试捕获所有错误。实际上,只需关闭表标签就可以了……谢谢,如果他真的按照正确的顺序打印了所有内容,他为什么要使用这些符号?他的代码是一个不匹配的HTML标记的游乐场,而这是ob_get_contents()无法修复的。如果他真的按正确的顺序打印了所有内容,为什么要使用它呢?他的代码是一个不匹配的HTML标记的游乐场,而这是ob_get_contents()无法修复的。