Jump to content

masnobi

Members
  • Posts

    8
  • Joined

  • Last visited

masnobi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all, I am trying to make sure that a user cannot move on unless they select a radiobutton, but unfortunately it's not working. I used same function with checkbox in my other page and it works perfect but i don't know why it is not working here Btw, this is not inside a form (as in other page I have used inside the form) PLEASE HELP echo "<td class='kooltd'><input type = 'radio' name = 'rFlight' value = '".$row['flight_id']."'></td>"; echo "<input type='submit' id='button1' name='booking' value='Make Booking for the Selected Flight' onclick='if(!this.form.rFlight.checked){alert('You must select a flight.');return false}'/></br>";
  2. Thanks a lot dude, you are a star
  3. Hi all, I am making a flight search engine where i am trying to create a autocomplete textbox. I mean when a user starts typing in the textbox, it will show all related data from my database table. I am new to programming and therefore I have adopt a code from online but it doesn't work, I don't know why. Can anyone please help? If you know any other easy way of doing it, please tell me also This is my Javascript code: <script type="text/javascript" src="js/jquery-1.4.2.js"></script> <script type='text/javascript' src="js/jquery.autocomplete.js"></script> <script type="text/javascript"> $().ready(function() { $("#depAirport").autocomplete("autoCompleteMain.php", { width: 260, matchContains: true, //mustMatch: true, //minChars: 0, //multiple: true, //highlight: false, //multipleSeparator: ",", selectFirst: false }); }); </script> This is my html: <form> <label for="depAirport">Deperture airport</label> <input type="text" id="depAirport" name="depAirport" placeholder="Type destination airport" required autofocus> </form> and this is my php: <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="airline_database"; // Database name $con = mysql_connect($host,$username,$password) or die(mysql_error()); mysql_select_db($db_name, $con) or die(mysql_error()); $q = strtolower($_GET["q"]); if (!$q) return; $sql = "select DISTINCT departure_airport as departure_airport from depAirport where departure_airport LIKE '%$q%'"; $rsd = mysql_query($sql); while($rs = mysql_fetch_array($rsd)) { $cname = $rs['departure_airport']; echo "$cname\n"; } ?> PLEASE HELP ASAP
  4. Hi all, I want to echo two variables inside the body of automatic email. i am trying to get those two variables from the form that customer just submitted. i am posting my code below, please help ASAP. Thanks in advance <?php if(isset($_POST['button_pressed'])) { $to=$Email; $subject='Hi There!!'; $body='Hi'; $Title . '' . $Surname; ', This is a demo email sent using PHP on XAMPP'; if (mail($to,$subject,$body)){ echo 'Mail sent successfully!'; } else{ echo 'Mail not sent!'; }} ?>
  5. No one replied!!!!! Anyway, I have fixed it, so no worries
  6. Hi all, I am trying to show my table information individually, but I just cannot find the way of doing it. At the moment it looks like this- (pic1) I want it to show like this - (pic2) Here are my code <?php $depAirport=clean($_POST['depAirport']); $arrAirport=clean($_POST['arrAirport']); $dDate=clean($_POST['dDate']); $rDate=clean($_POST['rDate']); $adult=clean($_POST['adult']); $child=clean($_POST['child']); $infants=clean($_POST['infants']); $myList=clean($_POST['myList']); function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } $sql= "SELECT * from flight WHERE departure_airport ='$depAirport' AND arrival_airport = '$arrAirport' AND departure_date ='$dDate'"; $result = mysql_query($sql); echo "<table id='kool' border='1' cellpadding='2' summary='Table holds flight information'> <tr> <th>Flight No</th> <th>Departure Airport</th> <th>Arrival Airport</th> <th>Departure Date</th> <th>Arrival Date</th> <th>Flight Price</th> <th>Flight Duration</th> <th>Airline</th> </tr>"; while ($row = mysql_fetch_array($result)) {echo "<tr>"; echo "<td>" . $row['flight_no'] . "</td>"; echo "<td>" . $row['departure_airport'] . "</td>"; echo "<td>" . $row['arrival_airport'] . "</td>"; echo "<td>" . $row['departure_date'] . "</td>"; echo "<td>" . $row['arrival_date'] . "</td>"; echo "<td>" . '£' . $row['flight_price'] . "</td>"; echo "<td>" . $row['flight_duration'] . "</td>"; echo "<td>" . $row['flight_name'] . "</td>"; echo "</tr>"; } ?> <tr> <td colspan="18">Total fare per Adult is <?php echo '£' . 'flight_price'; ?> <input type="submit" name="Select Flight" id="submit" style="float:right" /> </td> </tr> </tfoot> </table> Please HELP
  7. Hey guys, I fixed it. so no worries. thanks for help anyway
  8. Hi all, I am working on a project where I am creating a travel agency website. At the moment I am trying to get my search engine to get the details and show the result into next page, but nothing is working. can anyone please help? thanks in advance. sorry for my messy code as I AM VERY NEW TO PHP Here are my codes for the form on index.php <form id="search" Name ="sEngine" Method ="POST" ACTION ="search.php" style="background-image:url(images/background.jpg)"> <h2>Search Flights</h2> <fieldset> <input type = "radio" name = "type" id = "return" value = "yes" checked = "checked" /> <label for = "return">Return</label> <input type = "radio" name = "type" id = "single" value = "no" /> <label for = "single">Single</label> </fieldset> <fieldset id="des"> <ul> <li> <label for="depAirport">Deperture airport</label> <input type="text" id="depAirport" name="depAirport" placeholder="Type destination airport" required autofocus> </li> <li> <label for="arrAirport">Arrival airport</label> <input type="text" id="arrAirport" name="arrAirport" placeholder="Type arrival airport" required> </li> <li> <label for="dDate">Departure date</label> <input type="date" id="dDate" name="dDate" required> </li> <li> <label for="rdate">Return date</label> <input type="date" id="rDate" name="rDate" required> </li> </ul> </fieldset> <fieldset> <label for="adult" style="margin-left:10px;">Adult</label> <input type="number" id="adult" name="adult" min="1" max="20"> <label for="child" style="margin-left:8px;">Child </label> <input type="number" id="child" name="child" min="0" max="10"> <label for="infants" style="margin-left:8px;">Infants </label> <input type="number" id="infants" name="infants" min="0" max="10"> </fieldset> <fieldset> <label for="clsType" style="margin-left:80px;">Class type</label> <select id = "myList" name="myList"> <option value = "1" selected="selected">Economy</option> <option value = "2">Premium Economy</option> <option value = "3">Business</option> <option value = "4">First</option> </select> </fieldset> <br/> <button type= "submit" onclick="myfunc()">Search Now!</button> </form> Here are my codes for search.php <?php mysql_connect("localhost", "root", "masnobi");mysql_select_db("airline_database"); ?> <?php function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } $name=mysql_real_escape_string($_POST['depAirport']); //This value has to be the same as in the HTML form file $email=mysql_real_escape_string($_POST['arrAirport']); //This value has to be the same as in the HTML form file $sql= "SELECT * from 'flight' WHERE (departure_airport ='$depAirport' , arrival_airport = '$arrAirport', departure_date ='$dDate')"; echo "<table id='box' border='1' cellpadding='2' summary='Table holds flight information'> <tr> <th>flight_id</th> <th>flight_no</th> <th>departure_airport</th> <th>arrival_airport</th> <th>departure_date</th> <th>arrival_date</th> <th>flight_price</th> <th>flight_duration</th> <th>flight_name</th> </tr>"; while ($row = mysql_fetch_array($result)) {echo "<tr>"; echo "<td>" . $row['flight_id'] . "</td>"; echo "<td>" . $row['flight_no'] . "</td>"; echo "<td>" . $row['departure_airport'] . "</td>"; echo "<td>" . $row['arrival_airport'] . "</td>"; echo "<td>" . $row['departure_date'] . "</td>"; echo "<td>" . $row['arrival_date'] . "</td>"; echo "<td>" . '£' . $row['flight_price'] . "</td>"; echo "<td>" . $row['flight_duration'] . "</td>"; echo "<td>" . $row['flight_name'] . "</td>"; echo "</tr>"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.