단추를 클릭하면 여러 개의 PHP 코드가 실행되는 방식이 있습니까?PHP 코드 블럭을 실행할 JS OnClick 이벤트
예 :
이 버튼 개체를 클릭하면이 PHP 코드가 실행됩니다.
include("../includes/connect.php");
include("../includes/generateTimestamp.php");
include("../includes/knowthename.php");
$pid=$_POST['submit_id'];
$pname = $_POST['submit_name'];
$total = $_POST['submit_total'];
$quantity = $_POST['submit_qty'];
$price = $_POST['submit_price'];
$unit = $_POST['submit_unit'];
$change = $_POST['submit_sukli'];
$payment = $_POST['submit_payment'];
$count = $_POST['count'];
//explode
$newpid = explode(";",$pid);
$newpname = explode(";",$pname);
$newquantity = explode(";",$quantity);
$newprice = explode(";",$price);
$newpriceunit = explode(";",$unit);
$sql = mysql_query("INSERT INTO sales (sales_date, total_price, emp_id) VALUES ('$timestamp','$total', '$employee_id')");
mysql_query($sql);
$id_gen = mysql_insert_id();
$count = $count - 1;
while($count = -1){
$product_id = $newpid[$count];
$product_name = $newpname[$count];
$product_quantity = $newquantity[$count];
$product_price = $newprice[$count];
$sql2("INSERT INTO sales_details (sales_id,product_id,sales_qty,unit_price,net_price) VALUES ('$id_gen','$newpid[$count]','$product_quantity[$count]',
'$product_price[$count]','$newpriceunit[$count]')");
mysql_query($sql2);
}
header('Location: prompt.php?x=5');
}else{
echo 'Nothing here!';
}
나는
내가 그렇게 할 수있는 방법이없는 경우
이,이, 내가 그것을 클릭하면, 그것은 unbreak 의지와 코드의 그 무리를 계속 실행하는 차단기로 온 클릭 기능을 만들고 싶어 다른 방법들?원본 데이터가 $ _POST에서 왔기 때문에 데이터가 손실 (배열) 될 수 있으므로 function isset이 작동하지 않습니다. 내 희망은 onclick 이벤트이지만 어떻게해야할지 모르겠다.
컴퓨터의 위선을 가르쳐주세요! jQuery를 사용
나는이가 가능성이 jQuery를/Ajax 요청으로 수행 할 수 있습니다 말할 것 - http://api.jquery.com/jQuery.ajax/ – Batfan