Ejemplo n.º 1
0
 $fv = new formValidator();
 //from functions.php
 if (empty($_POST["guestid"])) {
     //if no guest has been selected no point in displaying other errors
     $fv->validateEmpty('guestid', 'No guest has been selected for reservation.');
 } else {
     $fv->validateEmpty('reservation_type', 'Please indicate if it\'s a Direct booking or Agent booking.');
     $fv->validateEmpty('meal_plan', 'Please select Meal Plan');
     $fv->validateEmpty('reserve_checkindate', 'Please enter checkin date for reservation');
     $fv->validateEmpty('roomid', 'Please indicate room being booked');
 }
 if ($fv->checkErrors()) {
     // display errors
     echo "<div align=\"center\">";
     echo '<h2>Resubmit the form after correcting the following errors:</h2>';
     echo $fv->displayErrors();
     echo "</div>";
 } else {
     $reserved_through = !empty($_POST["reservation_type"]) ? "'" . $_POST["reservation_type"] . "'" : 'NULL';
     $guestid = $_POST["guestid"];
     $reservation_by = !empty($_POST["reservation_by"]) ? "'" . $_POST["reservation_by"] . "'" : 'NULL';
     $reservation_by_phone = !empty($_POST["reservation_by_phone"]) ? "'" . $_POST["reservation_by_phone"] . "'" : 'NULL';
     $reserve_checkindate = !empty($_POST["reserve_checkindate"]) ? "'" . $_POST["reserve_checkindate"] . "'" : 'NULL';
     $reserve_checkoutdate = !empty($_POST["reserve_checkoutdate"]) ? "'" . $_POST["reserve_checkoutdate"] . "'" : 'NULL';
     $no_adults = !empty($_POST["no_adults"]) ? $_POST["no_adults"] : 'NULL';
     $no_child0_5 = !empty($_POST["no_child0_5"]) ? $_POST["no_child0_5"] : 'NULL';
     $no_child6_12 = !empty($_POST["no_child6_12"]) ? $_POST["no_child6_12"] : 'NULL';
     $no_babies = !empty($_POST["no_babies"]) ? $_POST["no_babies"] : 'NULL';
     $meal_plan = $_POST["meal_plan"];
     $billing_instructions = !empty($_POST["billing_instructions"]) ? "'" . $_POST["billing_instructions"] . "'" : 'NULL';
     $deposit = !empty($_POST["deposit"]) ? $_POST["deposit"] : 'NULL';
Ejemplo n.º 2
0
$logofile = Get_LogoFile();
$lang = get_language();
load_language($lang);
//get the list of all the room number in the system
$rmNoList = get_roomnolist();
if (isset($_POST['Submit'])) {
    $action = $_POST['Submit'];
    switch ($action) {
        case $_L['RM_addroom']:
        case $_L['BTN_update']:
            $fv = new formValidator();
            //from functions.php
            $fv->validateEmpty('roomno', $_L['RMT_noroom']);
            if ($fv->checkErrors()) {
                // display errors
                $validationMsgs = "<div align=\"left\"><h2>" . $_L['PR_formerr'] . "</h2>" . $fv->displayErrors() . "</div>";
            } else {
                /** 
                 * When the Room is to be added or updated the form data will be retrieved.
                 * This includes the phone, room number etc which is then
                 * submitted to the database. <br/>
                 */
                //gets photo.
                if (isset($_REQUEST['form_submit']) && 'form_uploader' == $_REQUEST['form_submit']) {
                    if (is_uploaded_file($_FILES['photo']['tmp_name'])) {
                        $filename = $_FILES['photo']['name'];
                        $filetype = $_FILES['photo']['type'];
                        $file_temp = $_FILES['photo']['tmp_name'];
                        $filesize = filesize($file_temp);
                        $photo = base64_encode(fread(fopen($file_temp, "rb"), $filesize));
                    }