[英]Display inline-block, it's working in HTML but not in PHP (I'm getting values in DB)
I find it's very strange. 我觉得这很奇怪。 Even though it's working in HTML but not in PHP.
即使它可以在HTML中工作,但不能在PHP中工作。
I will tell you the difference. 我会告诉你区别。
Here is JSFiddle for HTML. 这是用于HTML的JSFiddle 。
And for PHP. 对于PHP。 The following code are below:
以下代码如下:
<div class="home-section">
<h1> BEST SELLER </h1>
<p>
<form method="POST" action="cart_update.php">
<ul class=\"home-section-img\">
<?php
include("config.php");
$current_url = base64_encode($url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
$results = $mysqli->query("SELECT * FROM products ORDER BY id ASC");
if ($results) {
while($obj = $results->fetch_object())
{
echo "<li>";
echo ' <a href="#">
<img src="images/'.$obj->product_img_name.'">
<p> '.$obj->price.' </p>
<p> '.$obj->product_name.' </p>
</a>';
echo "</li>";
}
}
?>
</ul>
</form>
</p>
</div>
I tried to convert from HTML to PHP. 我试图将HTML转换为PHP。 The result is
display:inline-block;
结果为
display:inline-block;
doesn't work in PHP. 在PHP中不起作用。 but HTML works well for
display:inline-block;
但HTML可以很好地用于
display:inline-block;
. 。 The images in php should float left even though I am not using
float:left;
即使我没有使用
float:left;
php中的图像也应该向左float:left;
, i just want to use display:inline-block;
,我只想使用
display:inline-block;
So that I can insert pictures in database as many as I want. 这样我就可以在数据库中插入任意数量的图片。 The images must be placed in the centered div.
图像必须放置在居中的div中。 Any ideas?
有任何想法吗?
Following line should be outside of while
loop and write <form>
properly . 下一行应在
while
循环之外,并正确编写<form>
。
echo '<form method="POST" action="cart_update.php">';
echo "<ul class=\"home-section-img\">";
and 和
echo "</ul>";
echo "</form>";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.