function SubmitApplication($username, $HouseID, $start, $length) { global $conn; if (CheckApplication($username, $HouseID)) { return; } $query = $conn->prepare("INSERT INTO LeaseApplications (Username, HouseID, StartDate, Length, State) VALUES (:user,:house,:start, :length, 'Pending')"); $query->bindValue(':user', $username); $query->bindValue(':house', $HouseID); $query->bindValue(':start', $start); $query->bindValue(':length', $length); $query->execute(); }
<textarea name='InquireText' cols='70' rows='5'></textarea> <?php if (LoggedIn()) { echo "<input type='submit' value='Submit Enquiry'>"; } else { echo "<h3> Please Login to Submit Enquiry"; } ?> </form> <?php } ?> </div> <?php if (LoggedIn()) { if (!CheckApplication(Username(), $house->ID)) { ?> <div class="EnquireBox"> <h2> Apply For Property </h2> <!-- Application form --> <form action="Actions.php" method="get"> <input type="hidden" name="Action" value="LeaseApplication"> <input type="hidden" name="HouseID" value="<?php echo $house->ID; ?> "> <div class="InputLine"> <label>Lease Start Date</label> <input type="date" name="BookingDate"> </div> <div class="InputLine"> <label>Lease Duration</label> <select name="Duration"> <option value="3"> 3 Months </option> <option value="6"> 6 Months </option>