我一直試圖解決這個問題我的2天現在,我想不出任何其他事情了。
行126,129和132上的未定義變量。
我一直試圖使用isset或empty來獲得輸出,但它似乎不工作。
希望你們能幫助我:)未定義的變量,即使使用isset
<body>
<head>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/smoothscroll.js"></script>
<script src="js/resetOnClick.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet"/>
<link href="css/styles.css" rel="stylesheet"/>
<link href="css/notifbox.css" rel="stylesheet"/>
</head>
<center><label class="control-label" style="font-size:30px">Reservation</label></center>
<center><label class="control-label" style="font-size:15px">Edit Record</label></center>
<br/>
<br/>
<?php
//$id = isset($_GET['id'])? $_GET['id'] : "";
if(isset($_POST['editreservation']))
{
include('config/config1.php');
$rsvtn = $_POST['editreservation'];
$sel = "SELECT venue.venue_type, reservation.reservation_date, reservation.reservation_time
FROM venue
INNER JOIN reservation ON reservation.Venue_idVenue = venue.idVenue where idReservation = '2';";
$query = mysqli_query($conn,$sel);
echo $sel;
if(!$editreservation)
{
printf("Error: %s\n", mysqli_error($conn));
exit();
}
while($detail = mysqli_fetch_array($query))
{
$rid = $detail['idReservation'];
$ven = $detail['venue_type'];
$res_t = $detail['reservation_date'];
$res_d = $detail['reservation_time'];
echo $ven;
?>
<form class="form-horizontal form-label-left" method="post">
<div class="form-group">
<!--BACK Button-->
<a href="Reservation Records.php" class="col-md-6 col-md-offset-3" style="font-size:20px">Back</a>
<!--BACK Button-->
</div>
<!--<input type="hidden" name="submitted" value="true"/>-->
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Venue<span class="required">*</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="venue_type" data-content="<?php echo $ven;?>" class="form-control col-md-7 col-xs-12" name="venue_type" placeholder="Venue" required="required" type="text" value="<?php echo $ven;?>">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Reservation Date<span class="required">*</span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="reservation_date" data-content="<?php echo $res_d;?>" class="form-control col-md-7 col-xs-12" name="reservation_date" placeholder="Reservation Date" required="required" type="date" value="<?php echo $res_d;?>">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Reservation Time<span class="required">*</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="reservation_time" data-content="<?php echo $res_t;?>" class="form-control col-md-7 col-xs-12" name="reservation_time" placeholder="Reservation Time" required="required" type="time" value="<?php echo $res_t;?>">
</div>
</div>
<div class="ln_solid"></div>
<div class="form-group">
<div class="col-md-6 col-md-offset-3">
<input type="hidden" name="updRsvtn" value="<?php echo $detail['idReservation'];?>">
<input type="submit" class="btn btn-primary submits" value="Save Edited" onClick="Reservation Records.php" >
</div>
</div>
<?php
}
}
?>
<?php
if(isset($_POST['updRsvtn']))
{
include('config/config1.php');
$ven = $_POST['venue_type'];
$res_d = $_POST['reservation_date'];
$res_t = $_POST['reservation_time'];
if(!mysqli_query($conn,"UPDATE reservation, venue SET venue_type = '$ven', reservation_date = '$res_d', reservation_time = '$res_t' WHERE idReservation = '$id'"))
{
echo "Not Queried: Wrong variables !";
}
else
{
header("Location: Reservation Records.php");
}
mysqli_close($conn);
}
?>
</form>
<table class = "notif pos">
<thead>
<tr>
<th><center/><b>*Old Record</b></th>
</tr>
</thead>
<tbody>
<tr>
<td><center/><?php echo $ven;?></td>
</tr>
<tr>
<td><center/><?php echo $res_d;?></td>
</tr>
<tr>
<td><center/><?php echo $res_t;?></td>
</tr>
</tbody>
</table>
</body>
請指定代碼中的哪些行是126,129和132? – RK12
126 is
您似乎無法理解問題。在那一行上,該變量不存在。爲什麼它不存在?因爲你之前沒有定義過它。爲什麼之前沒有定義?因爲所有'if'和'while'條件取決於'false'的位置,它從來沒有被聲明過。找出原因,並/或改變你的邏輯以確定它的定義,並且/或者當它沒有被定義時不試圖輸出它。 – deceze