我的页面上有两个表格。但是一个操作页面(approve.php)似乎不起作用。如果它被批准或拒绝,我需要将一个字段设置为特定 ID 的活动。有没有办法在一个操作页面上做到这一点?
或者我在下面做错了什么?我屏蔽了插入脚本,因为我不知道它是否会导致问题。当我第一次批准时,它正在工作......
页:
<form method="get" action="approve.php">
<input type="hidden" name="rows" value="<?php echo $row[0] ?>" />
<p><a href='approve.php?id=<?php echo $row[0] ?>'><button url="#" class="btn btn-primary">Approve</button></a></p>
</form>
<form method="get" action="reject.php">
<div id="reject-form-<?php echo $row[0] ?>" class="modal hide fade">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3><?php _e('Reject Reason'); ?></h3>
</div>
<div class="modal-body">
<div id="message"></div>
<div class="controlgroup forgotcenter">
<div class="control">
<input id="reject" name="reject" type="text"/>
</div>
</div>
</div>
<div class="modal-footer">
<input type="hidden" name="rw_id" value="<?php echo $row[0] ?>" />
<a href='reject.php?id=<?php echo $row[0] ?>'><button data-complete-text="<?php _e('Done'); ?>" class="btn btn-primary pull-right" id="forgotsubmit"><?php _e('Submit'); ?></button></a>
<p class="pull-left"><?php _e('Please give a short reason for rejecting.'); ?></p>
</div>
</div>
<p><a data-toggle="modal" href="#reject-form-<?php echo $row[0] ?>" id="rejectlink" tabindex=-1><button url="#" class="btn btn-primary">Reject</button></a></p>
</form>
拒绝:
$id = $_GET['rw_id'];
$reason = $_GET['reject'];
$dbc = mysqli_connect('localhost', 'root', 'root', 'adjudication') or die('Connection error!');
$update = "UPDATE login_fines_adjudicated SET reject_reason = '$reason' WHERE id ='$id'";
mysqli_query($dbc, $update) or die('Database error!');
$update1 = "UPDATE login_fines_adjudicated SET active = 1 WHERE id ='$id'";
mysqli_query($dbc, $update1) or die('Database error, fine!');
header('location:adjudication.php');
批准:
$id = $_GET['rows'];
$dbc = mysqli_connect('localhost', 'root', 'root', 'adjudication') or die('Connection error!');
$updated = "UPDATE login_fines_adjudicated SET active = 1 WHERE id = '$id'";
mysqli_query($dbc, $updated) or die('Database error, active!');
/**$insert = "INSERT INTO login_fines(`date`, `time_in`, `time_out`, `value`, `area`, `reason`, `licence`)"
." SELECT `date_issued`, `time_arrived`, `time_departed`, `value`, `location`, `violation_reason`, `licence`"
." FROM login_fines_adjudicated WHERE id = '$id'";
mysqli_query($dbc, $insert) or die('Database error, fines!');**/
header('location:adjudication.php');
任何帮助,将不胜感激!