<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$zdb = $_SESSION["zdbyear_" . $dbname];
$admin = $_SESSION["admin_" . $dbname];
mysqli_select_db($conn,$zdb);


if (isset($_REQUEST['ename'])) {
//    $link       = "cepheisys.com/fab";
    
    $mailvouch = $_REQUEST[mailvouch];

    $getemail = mysqli_query($conn,"Select email from confmain where vouchno='$mailvouch'") or die(mysqli_error($conn));
    $memail = mysqli_fetch_array($getemail);
    $myemailid = $memail[email];
    
    $to = $myemailid;
//    browse($to);
    
    $getdest = mysqli_query($conn,"Select * from destination") or die(mysqli_error($conn));
    
    $gethotel = mysqli_query($conn,"Select * from confmain where `vouchno`='$mailvouch'") or die(mysqli_error($conn));
    
    $mhotel = mysqli_fetch_array($gethotel);





    $mhot1 = $mhotel[destcity1];
    $mhot2 = $mhotel[destcity2];
    $mhot3 = $mhotel[destcity3];
    $mhot4 = $mhotel[destcity4];
    $mhot5 = $mhotel[destcity5];
//    browse($mailvouch);
    $name = $_REQUEST[ename];
    $lastname = $_REQUEST[elastname];
    $destination = $_REQUEST[edest];
    $deptdate = $_REQUEST[etravdate];
//    $deptdate1    = DATE_FORMAT($deptdate, '%d-%m-%Y');

    $remarks = $_REQUEST[eremarks];

    $subject = "Feedback Form";


    $headers = "From: Seventh Sky International\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

    $message = "<form action='cepheisys.com/tlt/savefeed.php' method='GET'>";
    //$message .="<>";
    $message .= "<h1 style='color:#64CCFC;'>Seventh Sky International</h1>";
    $message .= "<table style='width: 80%;'>";
    $message .= "<tr>";
    $message .= "<td><b></b></td>";
    $message .= "<td>Not Good</td>";
    $message .= "<td>Satisfactory</td>";
    $message .= "<td>Good</td>";
    $message .= "<td>Excellent</td>";
    $message .= "</tr>";
    $message .= "<tr class='radio-inline'>";
    $message .= "<td><b>Over All Trip</b></td>";
//    <label class="radio-inline"><input type="radio" name="optradio">Option 1</label>
    $message .= "<td><input type='radio' name='trip' value='1' title='Not Good'></td>";
    $message .= "<td><input type='radio' name='trip' value='2' title='Satisfactory'></td>";
    $message .= "<td><input type='radio' name='trip' value='3' title='Good' checked='checked'></td>";
    $message .= "<td><input type='radio' name='trip' value='4' title='Excellent'></td>";
    $message .= "</tr>";
    if ($mhot1 != '') {
        $message .= "<tr class='radio-inline'>";
//    $message .= "<td><b>Service in City1</b></td>";
        $message .= "<td><b>Service in $mhot1</b></td>";
        $message .= "<td> <input type='radio' name='service1' value='1' title='Not Good'></td>";
        $message .= "<td> <input type='radio' name='service1' value='2' title='Satisfactory'></td>";
        $message .= "<td> <input type='radio' name='service1' value='3' title='Good' checked='checked'></td>";
        $message .= "<td> <input type='radio' name='service1' value='4' title='Excellent'></td>";
        $message .= "</tr>";

        $message .= "<tr>";
        $message .= "<td> <b>Hotel in $mhot1</b></td>";
        $message .= "<td> <input type='radio' name='hotel1' value='1' title='Not Good'></td>";
        $message .= "<td> <input type='radio' name='hotel1' value='2' title='Satisfactory'></td>";
        $message .= "<td> <input type='radio' name='hotel1' value='3' title='Good' checked='checked'></td>";
        $message .= "<td> <input type='radio' name='hotel1' value='4' title='Excellent'></td>";
        $message .= "</tr>";
    }
    if ($mhot2 != '') {
        $message .= "<tr class='radio-inline'>";
        $message .= "<td><b>Service in $mhot2</b></td>";
        $message .= "<td><input type='radio' name='service2' value='1' title='Not Good'></td>";
        $message .= "<td><input type='radio' name='service2' value='2' title='Satisfactory'></td>";
        $message .= "<td><input type='radio' name='service2' value='3' title='Good' checked='checked'></td>";
        $message .= "<td><input type='radio' name='service2' value='4' title='Excellent'></td>";
        $message .= "</tr>";

        $message .= "<tr>";
        $message .= "<td><b>Hotel in $mhot2</b></td>";
        $message .= "<td> <input type='radio' name='hotel2' value='1' title='Not Good'></td>";
        $message .= "<td> <input type='radio' name='hotel2' value='2' title='Satisfactory'></td>";
        $message .= "<td> <input type='radio' name='hotel2' value='3' title='Good' checked='checked'></td>";
        $message .= "<td> <input type='radio' name='hotel2' value='4' title='Excellent'></td>";
        $message .= "</tr>";
    }
    if ($mhot3 != '') {
        $message .= "<tr class='radio-inline'>";
        $message .= "<td><b>Service in $mhot3</b></td>";
        $message .= "<td><input type='radio' name='service3' value='1' title='Not Good'></td>";
        $message .= "<td><input type='radio' name='service3' value='2' title='Satisfactory'></td>";
        $message .= "<td><input type='radio' name='service3' value='3' title='Good' checked='checked'></td>";
        $message .= "<td><input type='radio' name='service3' value='4' title='Excellent'></td>";
        $message .= "</tr>";

        $message .= "<tr>";
        $message .= "<td><b>Hotel in $mhot3</b></td>";
        $message .= "<td><input type='radio' name='hotel3' value='1' title='Not Good'></td>";
        $message .= "<td><input type='radio' name='hotel3' value='2' title='Satisfactory'></td>";
        $message .= "<td><input type='radio' name='hotel3' value='3' title='Good' checked='checked'></td>";
        $message .= "<td><input type='radio' name='hotel3' value='4' title='Excellent'></td>";
        $message .= "</tr>";
    }
    if ($mhot4 != '') {
        $message .= "<tr class='radio-inline'>";
        $message .= "<td><b>Service in $mhot4</b></td>";
        $message .= "<td><input type='radio' name='service4' value='1' title='Not Good'></td>";
        $message .= "<td><input type='radio' name='service4' value='2' title='Satisfactory'></td>";
        $message .= "<td><input type='radio' name='service4' value='3' title='Good' checked='checked'></td>";
        $message .= "<td><input type='radio' name='service4' value='4' title='Excellent'></td>";
        $message .= "</tr>";

        $message .= "<tr>";
        $message .= "<td><b>Hotel in </b></td>";
        $message .= "<td><input type='radio' name='hotel4' value='1' title='Not Good'></td>";
        $message .= "<td><input type='radio' name='hotel4' value='2' title='Satisfactory'></td>";
        $message .= "<td><input type='radio' name='hotel4' value='3' title='Good' checked='checked'></td>";
        $message .= "<td><input type='radio' name='hotel4' value='4' title='Excellent'></td>";
        $message .= "</tr>";
    }
    if ($mhot5 != '') {
        $message .= "<tr class='radio-inline'>";
        $message .= "<td><b>Service in $mhot5</b></td>";
        $message .= "<td><input type='radio' name='service5' value='1' title='Not Good'></td>";
        $message .= "<td><input type='radio' name='service5' value='2' title='Satisfactory'></td>";
        $message .= "<td><input type='radio' name='service5' value='3' title='Good' checked='checked'></td>";
        $message .= "<td><input type='radio' name='service5' value='4' title='Excellent'></td>";
        $message .= "</tr>";

        $message .= "<tr>";
        $message .= "<td><b>Hotel in $mhot5</b></td>";
        $message .= "<td><input type='radio' name='hotel5' value='1' title='Not Good'></td>";
        $message .= "<td><input type='radio' name='hotel5' value='2' title='Satisfactory'></td>";
        $message .= "<td><input type='radio' name='hotel5' value='3' title='Good' checked='checked'></td>";
        $message .= "<td><input type='radio' name='hotel5' value='4' title='Excellent'></td>";
        $message .= "</tr>";
    }
    $message .= "</table>";

    $message .= "<table>";
    $message .= "<tr>";

    $message .= "<td><b>Would you like to receive updates about our special offers&nbsp;&nbsp;</b><input type='checkbox' name='offers' value='1'></td>";
//    $message .= "<td></td>";
    $message .= "</tr>";
    $message .= "<tr>";
    $message .= "<td><b>Other Comments   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  </b><textarea style='width:350px;height:100px;'  name='comments' value=''></textarea></td>";
    $message .= "<tr>";
    $message .= "<td><b>When do you planning to travel next &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  </b><select name='travel' value=''>
                 <option></option>
                 <option value='0'>After 3 Months</option>
                 <option value='1'>After 6 Months</option>
                 <option value='2'>Next Year</option>
                </select></td>";
//    $message .= "<td></td>";
    $message .= "</tr>";
//    $message .= "<tr>";
//    $message .= "<td><b>Which Destination &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  </b><select name='travel' value=''>
//                 <option></option>
//                getdest = mysqli_query($conn,'SELECT * FROM `destination`')or die(mysqli_error($conn));
//                while (mdest = mysqli_fetch_array(getdest)) {
//                        <option value='mdest[name]'>mdest[name]</option>
//                }
//                </select></td>";
////    $message .= "<td></td>";
//    $message .= "</tr>";
    $message .= "<tr>";
    $message .= "<td><button type='submit' name='submit' id='submit' value='Submit' style='height:50px;width:150px;'>Submit</button></td>";
    $message .= "</tr>";
    $message .= "</table>";
    $message .= "<input type='text' style='' name='vouchno' id='vouchno' value='$mailvouch' readonly>";
    $message .= "</form>";

//    if(mail($to, $subject, $message, $headers)){
//        Echo "success"; 
//    }
    mail($to, $subject, $message, $headers);
    Echo "success";
//    }
}
?>
 
