简体   繁体   中英

on link click display content in new div on same page, php/mysqli

I need a little quick help from you guys

Normally this is how we redirect to a new page, by getting the required output.

<a href="read.php?id=<?php echo $dn1['id']; ?>

I don't want to open a new page, instead I want to handle on the same page.

How to display main content in one <div> and on click display the detailed content on the 2nd <div> wrt <a href=> value.

<div> id | name | content </div>

Once any link is clicked it should display its replaced content in to 2nd div

<div>  Details content goes here  </div>

I have this scenario, but it does not give any option to place any value in href.

<a href="#" onclick="document.getElementById('test').style.display = 'block';">
Reply</a>

                <div class="element" id="test" style="display:none;"> 

You Can do this using of " iframe " tag

set target Attribute in " a "tag (name of iframe)

<a href="read.php?id=<?php echo $dn1['id']; ?> target="ifrm"> </a>


<div> id | name | content </div>

once any link is clicked it should display its replated content in to 2nd div

<div> <iframe name="ifrm"></iframe> Details content goes here  </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM