Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Location
    Indonesia, Manado
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to select and display it on another page from a search results?

    i have a code that can search from 5 diffrent options. my problem is how to choose one of the search results and display it on another page.

    this is my html code:
    Code:
    <form action="search.php" method="get"> 
      <table border=0>
          <tr>
            <td width=70><font color="#FFFFFF">Kota Berangkat </font></td>
              <td width=10><font color="#FFFFFF">:</font></td>
              <td width=20><font color="#FFFFFF">
              <!--<input type=text name=nama size=20>-->
    		  <select name='from'>  
            <option value="none">Berangkat</option>
            <option value="Jakarta">Jakarta</option>
            <option value="Manado">Manado</option>
            <option value="Surabaya">Surabaya</option>
           </select>
              </font></td>
            <td width=70><font color="#FFFFFF">Kota Tujuan</font></td>
              <td width=10><font color="#FFFFFF">:</font></td>
              <td width=20><font color="#FFFFFF">
              <select name='to'> 
                <option value="none">Tujuan</option>
            <option value="Manado">Manado</option>
            <option value="Jakarta">Jakarta</option>
            <option value="Surabaya">Surabaya</option>
            
    		</select>
              </font></td>
    		  <td width=70><font color="#FFFFFF">Kota Kembali </font></td>
              <td width=10><font color="#FFFFFF">:</font></td>
              <td width=20><font color="#FFFFFF">
              <!--<input type=text name=nama size=20>-->
    		  <select name='back'> 
                          <option value="none">Kembali</option>
            <option value="Jakarta">Jakarta</option>
            <option value="Manado">Manado</option>
            <option value="Surabaya">Surabaya</option>
            
    		</select>
              </font></td>
    	      </tr>
            <!--Kalender-->      
          </font></td>   
              <td width=70><font color="#FFFFFF">Departure</font></td>
                  <td width=10><font color="#FFFFFF">:</font></td>
                   <td width=2><font color="#FFFFFF">Tanggal yang tersedia<br></font>
                <select name='tanggalpergi'> 
                    <option value="">Tanggal</option>
            <option value="2012-12-1">Sabtu, 1 Desember 2012</option>
            <option value="2012-12-2">Minggu, 2 Desember 2012</option>
            <option value="2012-12-3">Senin, 3 Desember 2012</option>
            <option value="2012-12-4">Selasa, 4 Desember 2012</option>
            <option value="2012-12-5">Rabu, 5 Desember 2012</option>
            <option value="2012-12-6">Kamis, 6 Desember 2012</option>
            <option value="2012-12-7">Jumat, 7 Desember 2012</option>
            <option value="2012-12-8">Sabtu, 8 Desember 2012</option>
            <option value="2012-12-9">Minggu, 9 Desember 2012</option>
                      </select>
                      
    			  
    			<!-- Untuk pembuatan kalender-->
    			
    			
                  </font></td>   
              <td width=70><font color="#FFFFFF">Return</font></td>
                  <td width=10><font color="#FFFFFF">:</font></td>
                   <td width=2><font color="#FFFFFF">Tanggal Yang tersedia<br></font>
                <select name='tanggalkembali'> 
                    <option value="">Tanggal</option>
            <option value="2012-12-20">Kamis, 20 Desember 2012</option>
            <option value="2012-12-21">Jumat, 21 Desember 2012</option>
            <option value="2012-12-22">Sabtu, 22 Desember 2012</option>
            <option value="2012-12-23">Minggu, 23 Desember 2012</option>
            <option value="2012-12-24">Senin, 24 Desember 2012</option>
            <option value="2012-12-25">Selasa, 25 Desember 2012</option>
            <option value="2012-12-26">Rabu, 26 Desember 2012</option>
            <option value="2012-12-27">Kamis, 27 Desember 2012</option>
            <option value="2012-12-28">Jumat, 28 Desember 2012</option>            
                      </select></td></tr>
    			  
    			  <!-- Untuk pembuatan kalender-->
                  
                  </font></td>
    	      </tr>
        </table>
      <p>&nbsp;</p>
    </div>
    <div align="center"><font color="#FFFFFF">Class
        <select name='class'> 
          <option value="">Economy</option>
          <option value="">Business</option>
          </select>
    </font><font color="#FFFFFF">
    Adults
    <select name='Adults'>
      <option value="">1</option>
      <option value="">2</option>
      <option value="">3</option>
      <option value="">4</option>
      <option value="">5</option>
      <option value="">6</option>
      <option value="">7</option>
      <option value="">8</option>
      <option value="">9</option>
    </select>
    </font><font color="#FFFFFF">
     Child (2-11 Tahun)
     <select name='Child (2-11 yrs)'>
      <option value="">1</option>
      <option value="">2</option>
      <option value="">3</option>
      <option value="">4</option>
      <option value="">5</option>
      <option value="">6</option>
      <option value="">7</option>
      <option value="">8</option>
      <option value="">9</option>
    </select>
    </font></div>
    <div align="center">
      
      <div align="center">
        <div align="justify"></div>
        <div align="center"></div>
      </div>
    </div>
    
    <div align="center"><font color="#FFFFFF"><br>
    </font></div>
    <div align="center"><font color="#FFFFFF"><br>
        
    <!--test-->
     <!--<form action="search.php" method="get" >-->
         <font color="white">
    <input type="submit" name="submit" value="Find" /><!--<input type="text" name="query" />-->
    <input type="reset" value="Reset"/>
    and this is my php code:
    Code:
    <?php
    //mysql_connect("localhost","root","");
    //mysql_select_db("tiket_pesawat");
    
    //Search yg cuma 1 table
    // untuk konek database
    $db_host="localhost";
    $db_username="root";
    $db_password="";
    $db_name="tiket_pesawat";
    $db_table="tiket";
    $db_table_kolom="kota_berangkat";
    $db_table_kolom1="nomor_tiket";
    $db_table_kolom2="jumlah_tiket";
    $db_table_kolom3="tanggal_berangkat";
    $db_table_kolom4="hari_berangkat";
    $db_table_kolom5="waktu_berangkat";
    $db_table_kolom6="tanggal_tiba";
    $db_table_kolom7="hari_tiba";
    $db_table_kolom8="waktu_tiba";
    $db_table_kolom9="tanggal_kembali";
    $db_table_kolom10="hari_kembali";
    $db_table_kolom11="waktu_kembali";
    $db_table_kolom12="kota_tujuan";
    $db_table_kolom13="kota_kembali";
    $db_table_kolom14="nomor_penerbangan";
    $db_table_kolom15="harga";
    
     
    
    mysql_connect("$db_host","$db_username","$db_password");
    mysql_select_db("$db_name");
     
    $query=mysql_real_escape_string($_GET['from']);
    $query2=mysql_real_escape_string($_GET['to']);
    $query3=mysql_real_escape_string($_GET['back']);
    $query4=mysql_real_escape_string($_GET['tanggalpergi']);
    $query5=mysql_real_escape_string($_GET['tanggalkembali']);
    
    $query_for_result=mysql_query("SELECT *  
        FROM $db_table WHERE $db_table_kolom like '%".$query."%' and $db_table_kolom12 like '%".$query2."%' or $db_table_kolom13 like '%".$query3."%' and $db_table_kolom3 like '%".$query4."%' and $db_table_kolom9 like '%".$query5."%'");
    /*kota_berangkat,
        kota_tujuan,
        kota_kembali,
        nomor_tiket,
        jumlah_tiket,
        tanggal_berangkat,
        hari_berangkat,
        waktu_berangkat,
        tanggal_tiba,
        hari_tiba,
        waktu_tiba,
        tanggal_kembali,
        hari_kembali,
        waktu_kembali,
        nomor_penerbangan,
        harga*/
    echo "<h2>Pilihan Penerbangan yang dicari</h2><ol>";
    while($data_fetch= mysql_fetch_array($query_for_result))
    {
        echo "<li>";
        echo "Keberangkatan<br>";
        echo "Kota Berangkat        : {$data_fetch[$db_table_kolom]}<br>";
        echo "Tanggal Berangkat     : {$data_fetch[$db_table_kolom3]}<br>";
        echo "Hari Berangkat        : {$data_fetch[$db_table_kolom4]}<br>";
        echo "Waktu Berangkat       : {$data_fetch[$db_table_kolom5]}<br><br>";
        
        echo "Tiba<br>";
        echo "Kota Tujuan           : {$data_fetch[$db_table_kolom12]}<br>";
        echo "Tanggal Tiba          : {$data_fetch[$db_table_kolom6]}<br>";
        echo "Hari Tiba             : {$data_fetch[$db_table_kolom7]}<br>";
        echo "Waktu Tiba            : {$data_fetch[$db_table_kolom8]}<br><br>";
        
        echo "Kembali<br>";
        echo "Kota Kembali          : {$data_fetch[$db_table_kolom13]}<br>";
        echo "Tanggal Kembali       : {$data_fetch[$db_table_kolom9]}<br>";
        echo "Hari Kembali          : {$data_fetch[$db_table_kolom10]}<br>";
        echo "Waktu Kembali         : {$data_fetch[$db_table_kolom11]}<br><br>";
        
        echo "Detail Penerbangan<br>";
        echo "Nomor Tiket           : {$data_fetch[$db_table_kolom1]}<br>";
        echo "Jumlah Tiket tersedia : {$data_fetch[$db_table_kolom2]}<br>";
        echo "Nomor Penerbangan     : {$data_fetch[$db_table_kolom14]}<br>";
        echo "Harga                 : {$data_fetch[$db_table_kolom15]}<br>";
        
        echo "</li><hr/>";
    }
    echo "</ol>";
    
    
    mysql_close();
    
    ?>
    and this is my php code:
    PHP Code:
    <?php
    //mysql_connect("localhost","root","");
    //mysql_select_db("tiket_pesawat");

    //Search yg cuma 1 table
    // untuk konek database
    $db_host="localhost";
    $db_username="root";
    $db_password="";
    $db_name="tiket_pesawat";
    $db_table="tiket";
    $db_table_kolom="kota_berangkat";
    $db_table_kolom1="nomor_tiket";
    $db_table_kolom2="jumlah_tiket";
    $db_table_kolom3="tanggal_berangkat";
    $db_table_kolom4="hari_berangkat";
    $db_table_kolom5="waktu_berangkat";
    $db_table_kolom6="tanggal_tiba";
    $db_table_kolom7="hari_tiba";
    $db_table_kolom8="waktu_tiba";
    $db_table_kolom9="tanggal_kembali";
    $db_table_kolom10="hari_kembali";
    $db_table_kolom11="waktu_kembali";
    $db_table_kolom12="kota_tujuan";
    $db_table_kolom13="kota_kembali";
    $db_table_kolom14="nomor_penerbangan";
    $db_table_kolom15="harga";

     

    mysql_connect("$db_host","$db_username","$db_password");
    mysql_select_db("$db_name");
     
    $query=mysql_real_escape_string($_GET['from']);
    $query2=mysql_real_escape_string($_GET['to']);
    $query3=mysql_real_escape_string($_GET['back']);
    $query4=mysql_real_escape_string($_GET['tanggalpergi']);
    $query5=mysql_real_escape_string($_GET['tanggalkembali']);

    $query_for_result=mysql_query("SELECT *  
        FROM $db_table WHERE $db_table_kolom like '%"
    .$query."%' and $db_table_kolom12 like '%".$query2."%' or $db_table_kolom13 like '%".$query3."%' and $db_table_kolom3 like '%".$query4."%' and $db_table_kolom9 like '%".$query5."%'");
    /*kota_berangkat,
        kota_tujuan,
        kota_kembali,
        nomor_tiket,
        jumlah_tiket,
        tanggal_berangkat,
        hari_berangkat,
        waktu_berangkat,
        tanggal_tiba,
        hari_tiba,
        waktu_tiba,
        tanggal_kembali,
        hari_kembali,
        waktu_kembali,
        nomor_penerbangan,
        harga*/
    echo "<h2>Pilihan Penerbangan yang dicari</h2><ol>";
    while(
    $data_fetchmysql_fetch_array($query_for_result))
    {
        echo 
    "<li>";
        echo 
    "Keberangkatan<br>";
        echo 
    "Kota Berangkat        : {$data_fetch[$db_table_kolom]}<br>";
        echo 
    "Tanggal Berangkat     : {$data_fetch[$db_table_kolom3]}<br>";
        echo 
    "Hari Berangkat        : {$data_fetch[$db_table_kolom4]}<br>";
        echo 
    "Waktu Berangkat       : {$data_fetch[$db_table_kolom5]}<br><br>";
        
        echo 
    "Tiba<br>";
        echo 
    "Kota Tujuan           : {$data_fetch[$db_table_kolom12]}<br>";
        echo 
    "Tanggal Tiba          : {$data_fetch[$db_table_kolom6]}<br>";
        echo 
    "Hari Tiba             : {$data_fetch[$db_table_kolom7]}<br>";
        echo 
    "Waktu Tiba            : {$data_fetch[$db_table_kolom8]}<br><br>";
        
        echo 
    "Kembali<br>";
        echo 
    "Kota Kembali          : {$data_fetch[$db_table_kolom13]}<br>";
        echo 
    "Tanggal Kembali       : {$data_fetch[$db_table_kolom9]}<br>";
        echo 
    "Hari Kembali          : {$data_fetch[$db_table_kolom10]}<br>";
        echo 
    "Waktu Kembali         : {$data_fetch[$db_table_kolom11]}<br><br>";
        
        echo 
    "Detail Penerbangan<br>";
        echo 
    "Nomor Tiket           : {$data_fetch[$db_table_kolom1]}<br>";
        echo 
    "Jumlah Tiket tersedia : {$data_fetch[$db_table_kolom2]}<br>";
        echo 
    "Nomor Penerbangan     : {$data_fetch[$db_table_kolom14]}<br>";
        echo 
    "Harga                 : {$data_fetch[$db_table_kolom15]}<br>";
        
        echo 
    "</li><hr/>";
    }
    echo 
    "</ol>";


    mysql_close();

    ?>

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    I don't understand the question here. The form submits the options chosen and sends them to the search.php; you appear to deal with them there. So I'm not sure what other page you are talking about.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •