请在此表示慷慨和善意。Dymically在PHP中打开div?
我有一个php
项目,其中我必须显示来自db
的消息。我已经这样做了,但显示receiver
名称(有点像gmail
)我正面临这个问题。我的工作
示例代码是这样
<style>
#column_1,#column_2 {
width:1200px;
margin: 0 auto
}
#fbCheck {
display:none;
}
#fbCheck:not(:checked) ~ .sidebar-follow-button
{
display:none;
}
#fbCheck:checked ~ .sidebar-follow-button
{
display:block;
z-index : 10;
position: absolute;
background-color: white;
border: 1px solid rgba(0, 0, 0, 0.2);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
padding: 5px;
}
</style>
<?php
$userList = array('megha','meena','karishma','aadhya','ananya','pooja','mahesh','megha','meena','karishma','aadhya','ananya','pooja','mahesh','megha','meena','karishma','aadhya','ananya','pooja','mahesh','megha','meena','karishma','aadhya','ananya','pooja','mahesh','megha','meena','karishma','aadhya','ananya','pooja','mahesh');
//$sendername = getSenderName($sender_id);
$sendername = 'Admin';
?>
<div id='column_1'>
<div class="header">Sender : <?php echo $sendername;?></div>
<div class="content">
<?php if(count($userList)<2){
echo '<b>Receiver: </b>'.$userList[0].','.$userList[1];
}else{
echo '<b>Receiver: </b>'.$userList[0].','.$userList[1].'...';
?>
<input type="checkbox" id="fbCheck" />
<label for="fbCheck">
▼
</label>
<div class="sidebar-follow-button" style="left: 91px;">
<ul style="width :200px; height:80px; overflow:auto">
<?php
foreach($userList as $name){
echo '<li align="center">'.$name.'</li>';
}
?>
</ul>
</div>
<?php } ?>
</div>
<br>Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree
Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree
</div><br><br>
<?php $userList = array('Bharat','Himanshu','Junaid','Bhavin','Anil');?>
<div id='column_2'>
<div class="header">Sender : <?php echo $sendername;?></div>
<div class="content">
<?php if(count($userList)<2){
echo '<b>Receiver: </b>'.$userList[0].','.$userList[1];
}else{
echo '<b>Receiver: </b>'.$userList[0].','.$userList[1].'...';
?>
<input type="checkbox" id="fbCheck" />
<label for="fbCheck">
▼
</label>
<div class="sidebar-follow-button" style="left: 91px;">
<ul style="width :200px; height:80px; overflow:auto">
<?php
foreach($userList as $name){
echo '<li align="center">'.$name.'</li>';
}
?>
</ul>
</div>
<?php } ?>
</div>
<br>Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree
Your message starts from heree Your message starts from heree Your message starts from heree Your message starts from heree
</div>
我秀div's
这里,但所有这一切是由PHP foreach
回路中产生,并可能有很多content_1
div
。
它工作正常,但是当我在第二个箭头点击显示发件人列表它显示我的第一个消息接收器列表
这div
打开每次连我点击第二个箭头或任何所有的时间如果有超过2
请让我知道如何解决这个问题
任何帮助表示赞赏。在此先感谢
您使用Ajax吗? – Poiz
没有PHP和CSS只有 – user1234
我通过在db行中循环生成此代码 – user1234