如何使用php

时间:2017-01-31 15:43:30

标签: php

此代码用于在点击链接时获取order_no,我无法在此页面上实现任何javascript,因为它的工作就像模板而不是页面出现在浏览器中,无论如何它的工作正常但是如果我点击链接并且打开模态它显示相同的order_no,我必须刷新页面或在新选项卡中打开以获取order_no。 对不起我的英语,希望你明白我的意思

   <td align='center'  span style="font-weight:bold;"><a href ="edit.php?id=<?php echo $f_customer['order_no']?>" data-toggle = "modal" data-target = "#action"><?php echo $f_customer['order_no']?></a></td>

edit.php

 <?php
require_once 'config.php';
$q_edit_student = $conn->query("SELECT * FROM `orders` WHERE `order_no` = '$_REQUEST[id]'") or die(mysqli_error());
$f_edit_student = $q_edit_student->fetch_array();
?>


<div class = "modal-content ">
<div class  = "modal-body">

 <div class="form-group col-xs-4 col-md-4">
    <label for="name" class="control-label">Order Number</label>
    <input type = "text" name = "order_no"  id="order_no" value = "<?php echo $_REQUEST['id']?>"tabindex="1" class="form-control" autofocus />
</div>

1 个答案:

答案 0 :(得分:0)

从我对这个问题的理解很少。我猜您正在尝试显示特定订单的编辑表单

尝试以下

HTML

<a class="edit_link" href ="edit.php?id=<?php echo $f_customer['order_no']?>" data-toggle = "modal" data-target = "#action"><?php echo $f_customer['order_no']?></a>

的Javascript

$(".edit_link").click(function(){
    var href = $(this).attr('href');
    $.get(href).done(function(data){
        $("#action>.modal-body").html(data);
    });
});

这样的事情会为你做。