簡體   English   中英

如何使用模態視圖PHP獲取mysql數據

[英]How to get mysql data using modal view PHP

嗨,我正在嘗試使用模式視圖獲取 MySQL 值,請檢查此 URL http://demo.namastehost.com/account/update.php?id=13

我想獲得 id=id 的值,但我沒有從在模態視圖中分配 id=id 的位置獲得任何線索。 請建議。

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <button type="button" data-toggle="modal" data-target="#myModal" class="btn btn-primary">update Details</button> <!-- Modal--> <div id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" class="modal fade text-left"> <div role="document" class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 id="exampleModalLabel" class="modal-title">Truck Details</h5> <button type="button" data-dismiss="modal" aria-label="Close" class="close"><span aria-hidden="true">×</span></button> </div> <div class="modal-body"> <!DOCTYPE html> <html> <head> <title>Update Record</title> <div> <form name="form" method="post" action=""> <input type="hidden" name="new" value="1" /> <input name="id" type="hidden" value="db value should be here!" /> <p><input id="weight" type="text" name="weight" placeholder="Enter Weight" required value="db value should be here!" /></p> <p><input id="c_rate" type="text" name="c_rate" placeholder="Enter Rate" required value="db value should be here!" /></p> <p><input readonly id="c_total" type="text" name="c_total" placeholder="Enter Total" required value="db value should be here!" /></p> <p><input name="submit" type="submit" value="Update" /></p> </form> <?php } ?> </div>

當您詢問“如何獲取 id=id”時,簡短的回答是您應該使用$_GET (查詢)參數。

(文檔: https : //www.php.net/manual/en/reserved.variables.get.php

例如:

$id = $_GET['id'];

你可以隨意使用$id

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM