首页 > 解决方案 > 在 PHP 中从网格中获取 id

问题描述

我正在使用 PHP 进行后端开发。

我在 Html 中有网格,其中包含一堆记录。

现在我想要的是,我想在点击时获得预订 ID(点击事件有

java脚本函数)在预订

具有超链接的数字(如下图所示。)。

This is the java script function to get booking id  on click of booking Number

 $('.bu').on('click', function () {
                var Id = $(this).data("id");
                $.get( "mypage.php?id=" + Id );

                document.getElementById("idvalue").value = Id;
                 var inputdaata=document.getElementById("idvalue").value;

 **From above javascript already getting Booking id.

 Now i have to use that booking id in php.
 This is for grid in Html**

<td><a href="" name="abc"  
class ="bu"  data-toggle="modal" 
data-target="#myModal1"  
 data-id="<?php echo $json1[$i] 
['bookingid']; ?>"><?php echo 
 $json1[$i]['bookingNumber'];?> 
</a></td>

在此处输入图像描述

提前致谢。

标签: javascriptphphtml

解决方案


  
<script type="text/javascript">
	    function gocedula(text) {	

			var form_data = {
				is_ajax: 1,
				cedula: text
			};

			$.ajax({
				type: "POST",
				url: "getCedula.php",
				data: form_data,
				success: function(response) {
					window.location.replace("http://stackoverflow.com");
				}
			});
		
		}
	</script>
<a onclick="gocedula('.$valor.')">Booking Number</a>

在其他页面上使用

$_REQUEST["cedula"];


推荐阅读