<?php

	$rvid=$_GET['rvid'];

	$result = mysqli_query($conn, "SELECT * FROM reservation WHERE rv_id=$rvid") or die (mysql_error());

	$row = mysqli_fetch_array($result);

?>



<div class="right_col" role="main">

    <div class="">

        <div class="row">

            <div class="col-md-12 col-sm-12 col-xs-12">

                <div class="x_panel">

					<div class="x_title">

						<h2>Cleaning</h2>

						<div class="clearfix"></div>

					</div>

					<div class="x_content">



						<form class="form-horizontal form-label-left" method="post">



							<div class="item form-group">

								<div class="col-md-6 col-sm-6 col-xs-12">

									<input id="collectmoney" class="form-control col-md-7 col-xs-12" name="rvid" type="text" 

									value="<?php echo $row['rv_id'];?>" hidden>

								</div>

							</div>

							<div class="item form-group">

								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="collectmoney">Collect amount : <span class="required">*</span>

								</label>

								<div class="col-md-6 col-sm-6 col-xs-12">

									<input id="collectmoney" class="form-control col-md-7 col-xs-12" name="collectmoney" type="text" required>

								</div>

							</div>

							<div class="item form-group">

								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="note">Note

								</label>

								<div class="col-md-6 col-sm-6 col-xs-12">

									<textarea id="note" name="note" class="form-control col-md-7 col-xs-12"></textarea>

								</div>

							</div>

							<div class="item form-group">

								<label class="control-label col-md-3 col-sm-3 col-xs-12" for="cleanstatus">Status

								</label>

								<div class="col-md-6 col-sm-6 col-xs-12">

									<select class="form-control" name='cleanstatus'>

										<option value="1" checked>Processing</option>

										<option value="2">Complete</option>

										<option value="3">Problem</option>

										<option value="4">Cancel</option>

									</select>

								</div>

							</div>

							<div class="ln_solid"></div>

							<div class="form-group">

								<div class="col-md-6 col-md-offset-3">

									<button id="send" type="submit" class="btn btn-success" name="submit">Submit</button>

									<button type="submit" class="btn btn-primary" onclick="javascript:window.location='index.php?pagecontent=cleaninglist'">Cancel</button>

								</div>

							</div>

						</form>

					</div>

                </div>

            </div>

        </div>

    </div>

</div>



<?php 

	if (isset($_POST['submit']))

	{

		$rvid=$_POST['rvid'];

		$collectmoney=$_POST['collectmoney'];

		$note=$_POST['note'];

		$status=$_POST['cleanstatus'];

		

		mysqli_query($conn, "INSERT INTO clean (rv_id, c_amount, c_note, c_status) 

		VALUES ($rvid, '$collectmoney', '$note', $status)") or die (mysql_error());

		

		header('Location: index.php?pagecontent=cleaninglist');

	}

?>



