url 매개 변수를 통해 다른 페이지로 값을 전달하는 데 문제가 있습니다. REJECT 버튼을 클릭하여 선택한 예약 ID를 기반으로 예약을 거부하고 싶습니다.PHP URL 매개 변수가 다른 PHP 페이지로 전달 중
index.php를
<head>
<script src="jquery-latest.js" type="text/javascript"></script>
<script src="jquery.tablesorter.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$("#myTable").tablesorter({widgets: ['zebra']});
});
$(document).ready(function()
{
$("#myTable").tablesorter();
}
);
$(document).ready(function()
{
$("#myTable").tablesorter({sortList: [[0,0], [1,0]]});
}
);
</script>
<link href="style.css" rel="stylesheet" type="text/css">
<link href="stylelogin.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
include("dbconfig.php");
$query = "SELECT customer.companyName, customer.contactName, eventinfo.eventTitle,boothAlias,date, testbook.bstatus, testbook.username, bookingID from eventinfo, testbook, customer where testbook.username=customer.username AND testbook.eventID=eventinfo.eventID";
$o = '<table id="myTable" class="tablesorter" width="930px"><thead><tr><th>Company Name</th><th>Contact Name</th><th>Event</th><th>Booth</th><th>Date</th><th>Status</th></tr></thead><tbody>';
$result = mysql_query($query);
while($row=mysql_fetch_array($result))
{
$boothAlias=stripslashes($row["boothAlias"]);
$eventTitle=stripslashes($row["eventTitle"]);
$date=stripslashes($row["date"]);
$bstatus=stripslashes($row["bstatus"]);
$companyName=stripslashes($row["companyName"]);
$contactName=stripslashes($row["contactName"]);
$bookingID=stripslashes($row["bookingID"]);
if($bstatus==0){
$status="Pending";
}else if($bstatus==1){
$status="Successful";
}else{
$status="Reject";
}
$o .= '<tr><td width="120px">'.$companyName.'</td><td width="120px">'.$contactName.'</td><td width="180px">'.$eventTitle.
'</td><td width="70px">'.$boothAlias.'</td><td width="170px">'.$date.'</td><td width="70">'.$status.'</td><td>'.$bookingID.'
</td><td width="100"><input type="hidden" name="bookingID" value="<?php echo $bookingID; ?>" ><a href="approve_booking.php?bookingID=".$bookingID.
" name="REJECT" id="REJECT"><input width="100px" name="REJECT" type="submit" id="REJECT" value="Reject"></a></td></tr>';
}
$o .= '</tbody></table>';
echo $o;
?>
</body>
approve_booking.php
<?php
mysql_connect("localhost", "root", "") or die (mysql_error());
mysql_select_db("eventdb") or die (mysql_error());
$booking=$_GET['bookingID'];
echo $booking;
if(isset($_POST['APPROVED']))
{
$query2 = "UPDATE testbook SET bstatus ='0' WHERE bookingID='$booking'";
$result2 = @mysql_query($query2);
}
if (isset($_POST['REJECT']))
{
$query3 = "UPDATE testbook SET bstatus ='2' WHERE bookingID='$booking'";
$result3 = @mysql_query($query3);
}
?>
그리고 문제는 무엇입니까? – matino
질문이 누락되었습니다 :) –
1) SQL 인젝션주의 2) 특히 dev 환경에서 오류 서프 레서 제거 3) 어떻게 쿼리 문자열을 전달합니까? 나는 부러진/불완전한 형태만을 본다. GET 메소드를 사용하는 경우 2 개의 POST가 생성됩니다. 4) 실제로, 당신의 질문은 실제로 무엇입니까? –