I want to make a dynamic page but when I try to echo fetched data in HTML using echo between HTML tags the page structure breaks:
This image is with php code :
This is image without php code :
<div class="col-md-8 col-12">
<div class="intro-text">
<?php while($data = mysqli_fetch_assoc($result)): ?>
<h1 class="intro-lead-in" style="margin-top: 116px;">
<?php
$about = $data['content'];
$about_intro = explode("India",$about);
echo $about_intro[0];
?>
</h1>
<!-- <input style="text-align:center;margin-left:88px;color:white;background-color:#f7b733;margin-bottom:20px;margin-top:176px;margin-left:-12px;" class="btn btn-md" type="submit" value="Tell Me More"> -->
</div>
</div>
<?php endwhile; ?>
Close the while loop inside the div
:
<div class="col-md-8 col-12">
<div class="intro-text">
<?php while($data = mysqli_fetch_assoc($result)): ?>
<h1 class="intro-lead-in" style="margin-top: 116px;">
<?php
$about = $data['content'];
$about_intro = explode("India",$about);
echo $about_intro[0];
?>
</h1>
<?php endwhile; ?>
<!-- <input style="text-align:center;margin-left:88px;color:white;background-color:#f7b733;margin-bottom:20px;margin-top:176px;margin-left:-12px;" class="btn btn-md" type="submit" value="Tell Me More"> -->
</div>
</div>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments