0
我需要在调用弹出窗口时通过链接传递变量。当添加像我这样的变量时,名称通常与弹出窗口不匹配。通过弹出链接传递PHP变量
这是我有:
<a data-toggle="modal" href="#allMessages?id=<?php echo $job['job_id']; ?>" class="btn btn-warning btn-sm btn-icon">
<i class="fa fa-unlock-alt"></i>View All Messages
</a>
<div class="modal fade" id="allMessages" tabindex="-1" role="dialog" aria-labelledby="allMessages" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header success">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
<h4 class="modal-title">Reply</h4>
</div>
<?php
$getMessages = mysqli_query($mysqli,
"SELECT *
FROM messages
WHERE messages.job_id = $GET['id']
"
);
$messages = array();
while($message = mysqli_fetch_assoc($getMessages)) {
$messages[] = $message;
}
问题是,当我在按钮链接#allMessages的末尾添加变量ID =它不再调用弹出窗口?
的Javascript:
$("[data-toggle='popover']").popover();
});
function load_page() {
var selected_page = document.getElementById("selected_page").value;
if (selected_page != "") {
window.location.href = selected_page
//Please note that the value recived,
//in this case selected_page,
//should be a valid url!
//Therefore the value of the
//<option> tag should be itself
//a url !
//ex.: <option value="page.php"> is valid
//<option value="page_1"> is not valid
}
你在哪里使用弹出窗口中的'id'参数? – progNewbie 2014-10-22 12:13:02
你现在的问题是什么? – 2014-10-22 12:14:10
我做了编辑,但使用id不是问题,我的弹出窗口现在不会打开。问题是当我在按钮链接的末尾添加变量#allMessages?id = <?php echo $ job ['job_id']; ?>它不再调用弹出窗口。 – looloobs 2014-10-22 12:19:40