[英]How to add a column specific with values depending on other cell's value using javascript or php?
Let's say for example column dropdown represents a type of membership and depending on the value of dropdown, I would like to be able to display a column next to it that indicates the maximum number of companions I could bring.假设例如列下拉列表代表一种成员资格,并且根据下拉列表的值,我希望能够在它旁边显示一列,指示我可以携带的最大同伴数量。 Is there a way to do it via javascript or PHP or maybe SQL itself?
有没有办法通过javascript或PHP或SQL本身来做到这一点?
<?php
foreach ($dbh->query($sql) as $rows){
?>
<tr>
<td><?php echo $rows['name']?></td>
<td><?php echo $rows['email']?></td>
<td><?php echo $rows['number']?></td>
<td><?php echo $rows['org']?></td>
<td><?php echo $rows['dropdown']?></td>
<td><?php echo $rows['date']?></td>
</tr>
<?php
}
?>
Code:代码:
<?php
foreach ($dbh->query($sql) as $rows){
?>
<tr>
<td id="<?=$rows['id']?>"><?php echo $rows['name']?></td>
</tr>
<?php
}
?>
By clicking on the ajax button you will take the ID attribute of the column, send a request with the received id and add the value to the column created next to it.通过单击 ajax 按钮,您将获取列的 ID 属性,使用接收到的 ID 发送请求并将值添加到旁边创建的列中。
If I understand you correctly.如果我理解正确的话。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.