如何保护输入再次重新输入值?

时间:2017-09-28 11:38:26

标签: javascript javascript-events

这是我的代码

 <input type="text" size = "3" name="couponadd" id="couponadd" oninput="myFunction()" class="field" placeholder="Enter Coupon Code" />

脚本代码

function myFunction() {
var getcoupon = $("#couponadd").val();
}

数据库值

$Type =$_POST['type'];
  $Id=$_POST["id"];
$sqlData = array();
$stmt = $con->prepare("SELECT * FROM table where Id =? AND type= ?");

绑定参数

$stmt->bind_param("ss", $Id,$Type);
$stmt->execute();
$stmt->store_result();

绑定结果

$stmt-> bind_result($Id,$type,$Coupon_Code);
$numRows = $stmt->num_rows;
if($numRows > 0) {
while($stmt->fetch())
{

数组

$data[] = array($Id,$type,$Coupon_Code);
$NEventid=$Id;
$NCoupon_Code=$Coupon_Code;
$NTickettype=$Tickettype;
$NCouponPrice=$CouponPrice;

在隐藏输入中使用值

echo "<input type='hidden' id='dbcoupan' value='".$NCoupon_Code."' />";
echo "<input type='hidden' id='dbtckettype' value='".$NTickettype."' />";
echo "<input type='hidden' id='dbprice' value='".$NCouponPrice."' />";

0 个答案:

没有答案