PHP If this option is selected, do this - php

I have a very simple IF statement that worked for me a week ago, but mysteriously doesn't work for me now. I have a field when selected, creates an extra query.
The problem is, the doc is completely skipping over my if statement like it doesn't even exist
Here's the WHOLE CODE
<body id="bdy" onload="javascript:fg_hideform('fg_formContainer','fg_backgroundpopup');">
<div class="container_22" id="container">
<div id="rootDiv">
<div style="background-color: rgb(255, 255, 255);"
id="wrapper">
<div class="main">
<div id="mainMiddle" class="main-middle">
<div id="content" class="wide-content"
style="position: relative; width: 990px; background-color: rgb(255, 255, 255);
display: inline; margin-left:
15px;">
<span id="cntntMiddle_bannerTop"></span><!-- =search-bar | start -->
<div id="cntntMiddle_SearchBoxContainer"
style="margin-top: 20px; padding-left: 20px;">
<form action="search.php" class="search-bar" method="GET">
<h3>Search</h3>
<fieldset>
<div class="ctrlHolder inline">
<input type="checkbox" name="r" id="r" value="y">
Return Flight?
</div>
<div class="ctrlHolder
inline">
<input type="hidden" class="fnc-direction" id="curusd" name="Currency" value="USD" /> </div> <div id="trip-1" class="fnc-trip first"> <h6 ><span id="flight1">Departing Flight</span> </h6> <div
class="ctrlHolder"> <label for="from-1"> <span class="left">From</span> <span class="right">(City or Airport)</span> </label> <?php
$autocomplete1 = array();
mysql_connect('localhost', '', '');
mysql_select_db('');
$sql = "SELECT distinct rout_from FROM search_v ORDER BY rout_from ASC";
$r = mysql_query($sql);
while ($row = mysql_fetch_array($r))
{
$autocomplete1[] = $row['rout_from'];
}
?><input id="newsearch1" name="departure_label">
</div> <div class="ctrlHolder"><label for="from-1"> <span class="left">To</span> <span class="right">(City or Airport)</span> </label> <?php
$autocomplete = array();
mysql_connect('localhost', '', '');
mysql_select_db('');
$sql = "SELECT distinct rout_to FROM search_v ORDER BY rout_to ASC";
$r = mysql_query($sql);
while ($row = mysql_fetch_array($r))
{
$autocomplete[] = $row['rout_to'];
}
?><input id="newsearch" name="arrival_label"> </div> <div class="ctrlHolder"> <label for="leave-1">Depart</label>
<input type="text" id="f" name="txtDate1"/> </div> <div class="ctrlHolder"> <label for="leave-2">Arrive</label>
<input type="text" id="t" name="txtDate2"/></div> </div> </fieldset> <fieldset class="travelers">
<legend>Travelers
</legend>
<div class="ctrlHolder inline-select clearfix">
<div class="field">
<label for="adults">
<br />
Passengers</label>
<select
name="ddlPAxADT" id="ddlPaxADT">
<option selected="selected"
value="1">1</option><option value="2">2</option><option
value="3">3</option><option value="4">4</option><option value="5">5</option>
</select>
</div>
<br>
</div>
</fieldset>
<div class="submit-wrap
clearfix">
<button class="btn-reset" type="reset">
Reset
</button>
<input
name="submit" class="btn-search" type="submit" />
</div>
</form>
</div>
<div id="cntntMiddle_search-results" class="search-results">
<span id="cntntMiddle_lblResults"> <h2>Search Results</h2> <h3>Showing <span id="cntntMiddle_ctl01_lblFlightFilter">all
results</span></h3>
<?php
mysql_connect('localhost', '', '');
mysql_select_db('');
$search = $_GET['search'];
$sfrom = $_GET['departure_label'];
$sto = $_GET['arrival_label'];
$sfromda = $_GET['txtDate1'];
$stoda = $_GET['txtDate2'];
$padt = $_GET['ddlPaxADT'];
$currency = $_GET['Currency'];
$ret = $_GET['r'];
if ($ret!='y') {
$sql1 = mysql_query("SELECT * FROM search_v WHERE rout_to='$sfrom' AND rout_from='$sto' AND date_avialable='$stoda'") or die(mysql_error());
$runrows1 = mysql_fetch_array($sql1);
$flightid1 = $runrows1['flight_id'];
$aseats1 = $runrows1['seats_avialable'];
$todate1 = strftime("%b %d, %Y %l:%M %p" ,strtotime($runrows1['to_date']));
$date1 = strftime("%b %d, %Y %l:%M %p" ,strtotime($runrows1['date_avialable']));
$from1 = $runrows1['rout_from'];
$to1 = $runrows1['rout_to'];
$acost1 = $runrows1['adult_cost'];
$ccost1 = $runrows1['child_cost'];
$cur1 = $runrows1['currency'];
$oth1 = $runrows1['other_cost'];
$totalcost1= $acost1+$oth1;
$pr1 = $flightid1+5;
}
//echo outconstruct
$sql = mysql_query("SELECT * FROM search_v WHERE currency='$currency' AND
rout_to='$sto' AND rout_from='$sfrom' AND DATE_FORMAT(date_avialable,'%Y-%m-%d')
between'".$sfromda."' and '".$stoda."' LIMIT 10") or die(mysql_error()) ;
while ( $runrows = mysql_fetch_array($sql))
{
//get data
$flightid = $runrows['flight_id'];
$aseats = $runrows['seats_avialable'];
$todate = strftime("%b %d, %Y %l:%M %p" ,strtotime($runrows['to_date']));
$date = strftime("%b %d, %Y %l:%M %p" ,strtotime($runrows['date_avialable']));
$from = $runrows['rout_from'];
$to = $runrows['rout_to'];
$acost = $runrows['adult_cost'];
$ccost = $runrows['child_cost'];
$cur = $runrows['currency'];
$oth = $runrows['other_cost'];
$totalcost= $acost+$oth;
$pr = $flightid+5;
echo "";
?>
<?PHP
include('popup/contactform-code.php');
?>
<ul class="result-list clearfix">
<li class="item clearfix">
<span
id="cntntMiddle_ctl01_rptmain_lblFromt_0">
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th class="price">Price<?php echo $ret; ?></th>
<th>From</th>
<th>To</th>
<th>Depart</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6">
<div class="select-wrap">
<p class="seats">
<strong><?php echo $aseats; ?></strong><span>seats
left</span><em>at this price</em>
</p> <a href='javascript:fg_popup_form("fg_formContainer","fg_form_InnerContainer","fg_backgroundpopup");'
><img border='0' src='images/select_flight.png' width='121' height='34' /></a>
</div></td>
</tr>
</tfoot>
<tbody>
<tr>
<td class="price" rowspan="2"><a
style="font-weight: bold; cursor: pointer; text-decoration: none;"
herf="#" onclick='return ray.ajax("#");'><span
style="font-size: 24px; font-weight: bold;"><?php echo $totalcost; ?></span><span
style="font-size: 11px; margin-top: 2px; display: block; color: rgb(255, 255,
255); text-align: center; font-
weight: normal;">per
person</span><span
style="font-size: 12px; margin-top: 2px; display: block; color: rgb(255, 255,
255); text-align: center; font-
weight: normal;">(with fees)</span></a></td>
<td><?php echo $from; ?></td>
<td><?php echo $to ?></td>
<td style="padding-right: 2px;"><?php echo $date; ?></td>
</tr>
<tr>
<td><?php echo $to1; ?></td>
<td><?php echo $from1 ?></td>
<td style="padding-right: 2px;"><?php echo $date1; ?></td>
</tr>
</tbody>
</table> </span><a
id="cntntMiddle_ctl01_rptmain_lblResultDetails1_0" title="1"
href="javascript:__doPostBack('ctl00$cntntMiddle$ctl01$rptmain
$ctl00$lblResultDetails1','')"
style="color: Black;"></a><a class="close"
href="#">Close</a>
<div class="info clearfix">
<div class="info clearfix">
<h4>Departing Flight</h4>
<ul class="clearfix">
<li>
<h5><?php echo $from; ?> to <?php echo $to; ?> <?php echo $date; ?></h5>
<ul>
<li>
</li>
<li>
<strong>Flight #</strong> - <?php echo $flightid; ?>
</li>
<li>
<strong>Departure Time – </strong>
<?php echo $date; ?>
</li>
</ul>
</li>
</ul>
<ul>
<li style="padding-top: 5px;">
<span
style="color: rgb(212, 22, 13); font-weight: bold; font-size: 11px; text-
decoration: none;"> Fare Breakdown</span>
</li>
</ul>
<table class="more">
<tbody>
<tr>
<th>Passenger</th>
<th>Fare</th>
<th> Taxes and Fees</th>
<th>Qty</th>
<th>Total Cost</th>
</tr>
</tbody>
<tbody>
<tr>
<td>Adult</td>
<td
style="color: rgb(100, 100, 100); font-size: 11px; font-weight: bold;"><?php
echo $acost; ?></td>
<td><?php echo $oth; ?></td>
<td id="paxAdtTd">1</td>
<td><?php echo $acost; ?></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>Cost of Sale(<?php echo $cur; ?>)</td>
<td> </td>
<td
style="color: rgb(100, 100, 100); font-size: 14px; font-weight: bold;"><?php
echo $totalcost; ?></td>
</tr>
</tbody>
</table>
<br />
<span style="font-weight: bold; padding-top: 10px;"> *Additional airline fees for baggage may apply</span>
<div class="select-wrap">
<p class="seats">
<strong><?php echo $aseats; ?></strong><span>seats
left</span><em>at this price</em>
</p>
<button class="btn-select" type="button" id="start">
Select
Flight
</button>
</div>
</li>
</ul> </ul>
</ul>
<?php ;}?>
</div>
</div>

I think it's because of trailing newline character. So, before you actually do if($ret != 'y') just trim it $ret = trim($ret). give it a try.
$ret = $_GET['r'];
$ret = trim($ret);
if ($ret!='y')
{
// rest of your code
}

Try something like:
<?php
$ret = $_GET['r'];
if($ret != "y") {
echo "Yay!";
} else {
echo ":(";
}
?>
<html>
<head>
</head>
<body>
<form method="get" action="search.php">
<input type="checkbox" value="y" name="r" />Submit Query<br />
<input type="submit" value="Submit" name="submit" />
</form>
</body>
</html>

Related

How to filtered second page in paginate php

My pagination displays only all files that is stored in database, i want to filter data according date. when i filter data in first page it's work but when i change to the second page filter is not work again.
My problem is when I click the pagination, the second page will retrieve again all files that is stored in database. I want the second page is the filtered results.
<div class="row">
<div class="col-xs-12 col-md-7"></div>
<div class="col-xs-6 col-md-5" style="padding-right: 40px; padding-bottom: 20px;">
<header><h4 class="page-header"><b>Cari Berdasarkan Tanggal</b></h4></header>
<form class="form-horizontal" method="POST" action="">
<div class="form-group" style="padding-bottom: 0px; margin-bottom: 5px;">
<label class="col-sm-3 control-label"><b>Dari Tanggal :</b></label>
<div class="col-sm-5" style="padding-left: 0px;">
<input type="date" class="form-control" name="tgl_awal">
</div>
</div>
<div class="form-group" style="padding-bottom: 0px; margin-bottom: 5px;">
<label class="col-sm-3 control-label"><b>Sampai Tanggal :</b></label>
<div class="col-sm-5" style="padding-left: 0px;">
<input type="date" class="form-control" name="tgl_akhir">
</div>
</div>
<div class="form-group" style="padding-bottom: 0px; margin-bottom: 5px;">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-7" style="padding-left: 0px;">
<input type="submit" name="submit" value="Cari">
</div>
</div>
</form>
</div>
</div>
<!-- Database Fillter berdasarkan tanggal -->
<?php
include '../koneksi.php';
#$tgl_awal = $_POST['tgl_awal'];
#$tgl_akhir = $_POST['tgl_akhir'];
#$submit = $_POST['submit'];
echo $tgl_awal;
echo $tgl_akhir;
/*Filter Tanggal*/
if ($submit) {
$query1="SELECT * FROM item_aruskas i join aruskas a on i.id_aruskas=a.id WHERE noref like '%CI%' AND tgl between '$tgl_awal' AND '$tgl_akhir' order by tgl DESC ";
}else{
$query1="SELECT * FROM item_aruskas i join aruskas a on i.id_aruskas=a.id where noref like '%CI%' order by noref DESC ";
}
/*sort data*/
$pola='asc';
$polabaru='asc';
if(isset($_GET['orderby'])){
$orderby=$_GET['orderby'];
$pola=$_GET['pola'];
$query1="SELECT * FROM item_aruskas i join aruskas a on i.id_aruskas=a.id order by $orderby $pola ";
if($pola=='asc'){
$polabaru='desc';
}else{
$polabaru='asc';
}
}
/*Pagingging dan cek filter data*/
error_reporting(0);
$batas = 10;
$halaman = $_GET['halaman'];
$posisi = null;
if (empty($halaman)) {
$posisi=0;
$halaman=1;
}else{
$posisi = ($halaman-1)* $batas;
}
$result=mysqli_query($koneksi, $query1 .= "limit $posisi,$batas") or die(mysqli_error());
$cek = mysqli_num_rows($result);
if ($cek < 1) {
?>
<div class="row">
<div class="col-md-4"></div><div class="col-md-8"></div>
</div>
<div class="row">
<div class="col-md-4"></div><div class="col-md-8"></div>
</div>
<div class="row">
<div class="col-md-4"></div><div class="col-md-8"></div>
</div>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4" style="text-align: center;"><h4><b>Data Tidak Ditemukan.<br>Kembali Laporan Kas Masuk</b></h4></div><div class="col-md-4"></div>
</div>
<?php
}else{
if (!isset($tgl_awal,$tgl_akhir)) {
?>
<!-- Baris Cetak Data -->
<div class="row">
<div class="col-xs-12 col-md-7" style="margin-left: 40px; padding-bottom: 20px;">
<a href="cetak_lap_km.php" target="_blank">
<button class="btn btn-default btn-lg"><img src="../img/print16.png" style="padding-right: 10px;"><b>Cetak </b></button>
</a>
</div>
<div class="col-xs-6 col-md-5"></div>
</div>
<?php }else{
?>
<div class="row">
<div class="col-xs-12 col-md-7" style="margin-left: 40px; padding-bottom: 20px;">
<form method="POST" action="../laporan/cetak_lap_km.php" target="_blank" >
<input type="hidden" name="tgl_awal" value="<?php echo $tgl_awal; ?>">
<input type="hidden" name="tgl_akhir" value="<?php echo $tgl_akhir; ?>">
<button name="submit" class="btn btn-default "><img src="../img/print16.png" style="padding-right: 10px;"><b>Cetak </b></button>
</form>
</div>
<div class="col-xs-6 col-md-5"></div>
</div>
<?php } ?>
<div class="row">
<div class="col-lg-12">
<section class="panel">
<header class="panel-heading" style="text-align: center;">
<b>Laporan Kas Masuk</b>
</header>
<div class="table-responsive">
<table class="table table-striped table-advance table-hover table-bordered">
<thead>
<tr>
<td style="text-align: center; width: 5%;">No.</td>
<td style="width: 25%; text-align: center;">
<a href='lap_km.php?orderby=nama&pola=<?=$polabaru;?>'>Nama</a>
</td>
<td align="center">Memo</td>
<td style="text-align: center;width: 10%;">
<a href='lap_km.php?orderby=noref&pola=<?=$polabaru;?>'>No. Referensi</a>
</td>
<td align="center" style="width: 10%;">
<a href='lap_km.php?orderby=tgl&pola=<?=$polabaru;?>'>Tanggal</a>
</td>
<td align="center" style="width: 12%;">
<a href='lap_km.php?orderby=nilai&pola=<?=$polabaru;?>'>Nilai</a>
</td>
</tr>
</thead>
<?php
include '../koneksi.php';
function format_rupiah($angka){
$rupiah="Rp " . number_format($angka,0,',','.');
return $rupiah;
}
$no = $posisi + 0;
while($record = mysqli_fetch_array($result)){
$no++;
?>
<tbody>
<tr>
<td style="text-align: center;"><?php echo $no; ?></td>
<td style="text-align: center;"><?php echo $record['nama'];?></td>
<td><?php echo $record['memo'];?></td>
<td style="text-align: center;"><?php echo $record['noref']; ?></td>
<td style="text-align: center;"><?php echo date('d-m-Y', strtotime($record['tgl']));?></td>
<td style="text-align: right;"><?php echo format_rupiah($record['nilai']);?></td>
</tr>
<?php }
?>
</tbody>
</table>
<?php
/*Menghitung Jumlah data*/
if (!isset($tgl_awal,$tgl_akhir)) {
$sql_paging = mysqli_query($koneksi, "SELECT nama from item_aruskas i join aruskas a on i.id_aruskas=a.id where noref like '%CI%' ");
}else{
$sql_paging = mysqli_query($koneksi, "SELECT nama from item_aruskas i join aruskas a on i.id_aruskas=a.id WHERE noref like '%CI%' AND tgl between '$tgl_awal' AND '$tgl_akhir' order by tgl DESC ");
}
$jmldata = mysqli_num_rows($sql_paging);
$jmlhalaman = ceil($jmldata / $batas);
?>
<div class="row">
<div class="col-md-8" style="font-size: large; text-align: left; padding-left: 27px;">
<?php
echo "<b>Halaman : </b>";
for($i = 1; $i <= $jmlhalaman; $i++)
if($i != $halaman) {
echo "<a href=lap_km.php?halaman=$i>$i</a>|";
} else {
echo "<b>$i</b>|";
}
mysqli_close($koneksi);?>
</div>
<div class="col-md-4" style="font-size: large; text-align: right; padding-right: 28px;">
Jumlah data :<?php echo $jmldata;?>
</div>
</div>
<?php } ?>
</div>
any help is appreciated
What Changes I Did.
1) Changed method='POST' to method='GET'.
2) Changed this whole section of code according to requirement.
<!-- Database Fillter berdasarkan tanggal -->
<?php
include '../koneksi.php';
$tgl_awal = $_GET['tgl_awal'];
$tgl_akhir = $_GET['tgl_akhir'];
$submit = $_GET['submit'];
$search_query = "&tgl_awal=".$tgl_awal."&tgl_akhir=".$tgl_akhir."&submit=".$submit;
$main_query = "SELECT * FROM item_aruskas i join aruskas a on i.id_aruskas=a.id ";
$query_condition = "";
/*Filter Tanggal*/
if ($submit) {
$query_condition = " WHERE noref like '%CI%' AND tgl between '$tgl_awal' AND '$tgl_akhir' order by tgl DESC ";
} else {
$query_condition = " WHERE noref like '%CI%' order by noref DESC ";
}
/*sort data*/
$pola = 'asc';
$polabaru = 'asc';
if(isset($_GET['orderby'])){
$orderby = $_GET['orderby'];
$pola = $_GET['pola'];
$search_query = $search_query."&pola=".$pola;
$query_condition = " order by $orderby $pola";
if($pola == 'asc'){
$polabaru='desc';
} else {
$polabaru='asc';
}
}
/*Pagingging dan cek filter data*/
error_reporting(0);
$batas = 10;
$halaman = isset($_GET['halaman']) ? $_GET['halaman'] : 1;
$posisi = ($halaman-1)* $batas;
$query1 = $main_query.$query_condition." limit $posisi,$batas";
$result=mysqli_query($koneksi, $query1) or die(mysqli_error());
$cek = mysqli_num_rows($result);
3) Changed in pagination URL/Link. Appended Search URL (GET Paramaeters)
if($i != $halaman) {
echo "<a href=lap_km.php?halaman=$i.$search_query>$i</a>|";
} else {
echo "<b>$i</b>|";
}
4) Changed
if (!isset($tgl_awal,$tgl_akhir)) {
$sql_paging = mysqli_query($koneksi, "SELECT nama from item_aruskas i join aruskas a on i.id_aruskas=a.id where noref like '%CI%' ");
}else{
$sql_paging = mysqli_query($koneksi, "SELECT nama from item_aruskas i join aruskas a on i.id_aruskas=a.id WHERE noref like '%CI%' AND tgl between '$tgl_awal' AND '$tgl_akhir' order by tgl DESC ");
}
To
$sql_paging = mysqli_query($koneksi,$query1);
5) Changed
<thead>
<tr>
<td style="text-align: center; width: 5%;">No.</td>
<td style="width: 25%; text-align: center;">
<a href='lap_km.php?orderby=nama&pola=<?=$polabaru;?>'>Nama</a>
</td>
<td align="center">Memo</td>
<td style="text-align: center;width: 10%;">
<a href='lap_km.php?orderby=noref&pola=<?=$polabaru;?>'>No. Referensi</a>
</td>
<td align="center" style="width: 10%;">
<a href='lap_km.php?orderby=tgl&pola=<?=$polabaru;?>'>Tanggal</a>
</td>
<td align="center" style="width: 12%;">
<a href='lap_km.php?orderby=nilai&pola=<?=$polabaru;?>'>Nilai</a>
</td>
</tr>
</thead>
To
<thead>
<tr>
<td style="text-align: center; width: 5%;">No.</td>
<td style="width: 25%; text-align: center;">
<a href='lap_km.php?orderby=nama<?=$search_query;?>'>Nama</a>
</td>
<td align="center">Memo</td>
<td style="text-align: center;width: 10%;">
<a href='lap_km.php?orderby=noref<?=$search_query;?>'>No. Referensi</a>
</td>
<td align="center" style="width: 10%;">
<a href='lap_km.php?orderby=tgl<?=$search_query;?>'>Tanggal</a>
</td>
<td align="center" style="width: 12%;">
<a href='lap_km.php?orderby=nilai<?=$search_query;?>'>Nilai</a>
</td>
</tr>
</thead>
Updated Code
<div class="row">
<div class="col-xs-12 col-md-7"></div>
<div class="col-xs-6 col-md-5" style="padding-right: 40px; padding-bottom: 20px;">
<header><h4 class="page-header"><b>Cari Berdasarkan Tanggal</b></h4></header>
<form class="form-horizontal" method="GET" action="">
<div class="form-group" style="padding-bottom: 0px; margin-bottom: 5px;">
<label class="col-sm-3 control-label"><b>Dari Tanggal :</b></label>
<div class="col-sm-5" style="padding-left: 0px;">
<input type="date" class="form-control" name="tgl_awal">
</div>
</div>
<div class="form-group" style="padding-bottom: 0px; margin-bottom: 5px;">
<label class="col-sm-3 control-label"><b>Sampai Tanggal :</b></label>
<div class="col-sm-5" style="padding-left: 0px;">
<input type="date" class="form-control" name="tgl_akhir">
</div>
</div>
<div class="form-group" style="padding-bottom: 0px; margin-bottom: 5px;">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-7" style="padding-left: 0px;">
<input type="submit" name="submit" value="Cari">
</div>
</div>
</form>
</div>
</div>
<!-- Database Fillter berdasarkan tanggal -->
<?php
include '../koneksi.php';
$tgl_awal = $_GET['tgl_awal'];
$tgl_akhir = $_GET['tgl_akhir'];
$submit = $_GET['submit'];
$search_query = "&tgl_awal=".$tgl_awal."&tgl_akhir=".$tgl_akhir."&submit=".$submit;
$main_query = "SELECT * FROM item_aruskas i join aruskas a on i.id_aruskas=a.id ";
$query_condition = "";
/*Filter Tanggal*/
if ($submit) {
$query_condition = " WHERE noref like '%CI%' AND tgl between '$tgl_awal' AND '$tgl_akhir' order by tgl DESC ";
} else {
$query_condition = " WHERE noref like '%CI%' order by noref DESC ";
}
/*sort data*/
$pola = 'asc';
$polabaru = 'asc';
if(isset($_GET['orderby'])){
$orderby = $_GET['orderby'];
$pola = $_GET['pola'];
$search_query = $search_query."&pola=".$pola;
$query_condition = " order by $orderby $pola";
if($pola == 'asc'){
$polabaru='desc';
} else {
$polabaru='asc';
}
}
/*Pagingging dan cek filter data*/
error_reporting(0);
$batas = 10;
$halaman = isset($_GET['halaman']) ? $_GET['halaman'] : 1;
$posisi = ($halaman-1)* $batas;
$query1 = $main_query.$query_condition." limit $posisi,$batas";
$result=mysqli_query($koneksi, $query1) or die(mysqli_error());
$cek = mysqli_num_rows($result);
if ($cek < 1) {
?>
<div class="row">
<div class="col-md-4"></div><div class="col-md-8"></div>
</div>
<div class="row">
<div class="col-md-4"></div><div class="col-md-8"></div>
</div>
<div class="row">
<div class="col-md-4"></div><div class="col-md-8"></div>
</div>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4" style="text-align: center;"><h4><b>Data Tidak Ditemukan.<br>Kembali Laporan Kas Masuk</b></h4></div><div class="col-md-4"></div>
</div>
<?php } else {
if (!isset($tgl_awal,$tgl_akhir)) {?>
<!-- Baris Cetak Data -->
<div class="row">
<div class="col-xs-12 col-md-7" style="margin-left: 40px; padding-bottom: 20px;">
<a href="cetak_lap_km.php" target="_blank">
<button class="btn btn-default btn-lg"><img src="../img/print16.png" style="padding-right: 10px;"><b>Cetak </b></button>
</a>
</div>
<div class="col-xs-6 col-md-5"></div>
</div>
<?php } else {?>
<div class="row">
<div class="col-xs-12 col-md-7" style="margin-left: 40px; padding-bottom: 20px;">
<form method="POST" action="../laporan/cetak_lap_km.php" target="_blank" >
<input type="hidden" name="tgl_awal" value="<?php echo $tgl_awal; ?>">
<input type="hidden" name="tgl_akhir" value="<?php echo $tgl_akhir; ?>">
<button name="submit" class="btn btn-default "><img src="../img/print16.png" style="padding-right: 10px;"><b>Cetak </b></button>
</form>
</div>
<div class="col-xs-6 col-md-5"></div>
</div>
<?php } ?>
<div class="row">
<div class="col-lg-12">
<section class="panel">
<header class="panel-heading" style="text-align: center;">
<b>Laporan Kas Masuk</b>
</header>
<div class="table-responsive">
<table class="table table-striped table-advance table-hover table-bordered">
<thead>
<tr>
<td style="text-align: center; width: 5%;">No.</td>
<td style="width: 25%; text-align: center;">
<a href='lap_km.php?orderby=nama<?=$search_query;?>'>Nama</a>
</td>
<td align="center">Memo</td>
<td style="text-align: center;width: 10%;">
<a href='lap_km.php?orderby=noref<?=$search_query;?>'>No. Referensi</a>
</td>
<td align="center" style="width: 10%;">
<a href='lap_km.php?orderby=tgl<?=$search_query;?>'>Tanggal</a>
</td>
<td align="center" style="width: 12%;">
<a href='lap_km.php?orderby=nilai<?=$search_query;?>'>Nilai</a>
</td>
</tr>
</thead>
<?php
include '../koneksi.php';
function format_rupiah($angka){
$rupiah="Rp " . number_format($angka,0,',','.');
return $rupiah;
}
$no = $posisi + 0;
while($record = mysqli_fetch_array($result)){
$no++;
?>
<tbody>
<tr>
<td style="text-align: center;"><?php echo $no; ?></td>
<td style="text-align: center;"><?php echo $record['nama'];?></td>
<td><?php echo $record['memo'];?></td>
<td style="text-align: center;"><?php echo $record['noref']; ?></td>
<td style="text-align: center;"><?php echo date('d-m-Y', strtotime($record['tgl']));?></td>
<td style="text-align: right;"><?php echo format_rupiah($record['nilai']);?></td>
</tr>
<?php }
?>
</tbody>
</table>
<?php
/*Menghitung Jumlah data*/
$sql_paging = mysqli_query($koneksi,$query1);
$jmldata = mysqli_num_rows($sql_paging);
$jmlhalaman = ceil($jmldata / $batas);
?>
<div class="row">
<div class="col-md-8" style="font-size: large; text-align: left; padding-left: 27px;">
<?php
echo "<b>Halaman : </b>";
for($i = 1; $i <= $jmlhalaman; $i++)
if($i != $halaman) {
echo "<a href=lap_km.php?halaman=$i.$search_query>$i</a>|";
} else {
echo "<b>$i</b>|";
}
mysqli_close($koneksi);?>
</div>
<div class="col-md-4" style="font-size: large; text-align: right; padding-right: 28px;">
Jumlah data :<?php echo $jmldata;?>
</div>
</div>
<?php } ?>
</div>
I did my best to give you desired result. Have a look.

updating value and displaying the value on existing select option

first,I have table display from database, in each row it has update button.
second, i have a four (4) collapsible select option form.
third, the select option form has value from database. this value is also present in the column on the table above(first).
Now what i want is when i update the value from the row on the table, the collapsible form will open then the value from the table will display on the select option form.
Here's my code. the code below cant open the collapsible form and display the value on the select option form.
displaytable.php
<?php
$output='';
$noresult='';
if (isset($_POST['search']))
{
$globalpid = $_POST['search'];
$query = mysql_query("SELECT * FROM transaction where patientid ='$globalpid' order by trandate asc") or die ("could not search");
$count = mysql_num_rows($query);
$globalpid = mysql_real_escape_string($globalpid);
if($count == '' && $countname==0)
{
?>
<?php require_once 'search.php'; ?>
<div class="container" style="padding-left:30px">
<br><p><font color="#0B3861"><?php echo "There was no search results!"; ?> </font>
</div>
</div>
<?php }else{
?>
<?php
$total = '';
$add=mysql_query("SELECT SUM(tranamount) from transaction where patientid = $globalpid");
while($row=mysql_fetch_array($add))
{
$totalamount=$row['SUM(tranamount)'];
}
require_once 'transactionheadermenu.php';
?>
<div class="container" style="padding-top:0px; padding-left:30px; padding-right:30px;">
<div class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title"><font color="#2B547E"><?php echo "$outputname";?></font></h3></div>
<div class="panel-body">
<?php require_once 'billpatientquery.php';?>
<?php
echo "<table class='table table-hover';>
<tr>
<td style='border:1px solid; color:gray' width='145px' align='center'>Patient ID</td>
<td style='border:1px solid; color:gray' width='145px' align='center'>Date</td>
<td style='border:1px solid; color:gray' width='600px' align='center'>Item / Description</td>
<td style='border:1px solid; color:gray' width='90px' align='center'>Quantity</td>
<td style='border:1px solid; color:gray' width='90px' align='center'>Price</td>
<td style='border:1px solid; color:gray' width='150px' align='center'>Amount</td>
<td style='border:1px solid; color:gray' width='30px' align='center'>Update</td>
<td style='border:1px solid; color:gray' width='30px' align='center'>Delete</td>
</tr>";
while($row = mysql_fetch_array($query))
{
echo "
<tr>
<td style='border:1px solid; color:gray' width='145px' align='center'>".$row['patientid']."</td>
<td style='border:1px solid; color:gray' width='145px' align='center'>".$row['trandate']."</td>
<td style='border:1px solid; color:gray' width='600px'>".$row['trandescription']."</td>
<td style='border:1px solid; color:gray' width='90px' align='center'>".$row['tranquantity']."</td>
<td style='border:1px solid; color:gray' width='90px' align='right'>".number_format($row['tranunitprice'],2)."</td>
<td style='border:1px solid; color:gray' width='150px' align='right'>".number_format($row['tranamount'],2)."</td>
<td style='border:1px solid; color:gray'><a href='updatebillindex.php?update=$row[id]'>update</a></td>
<td style='border:1px solid; color:gray'><button class='btn btn-default btn-sm';><a href='updatebillindex.php?update=$row[0]'>edit
<span class='glyphicon glyphicon-trash'></span></a></button></td>
</tr> ";
}
echo "</table>";
?>
</div>
</div>
</div>
<?php }
} ?>
updatebillindex.php
?php
if (isset($_GET['update']))
//
{
$id = $_GET['update'];
// //$tranid = $_POST['update'];
//$patientid = $_POST['update'];
//$trandate = $_POST['update'];
//$getname = $_POST['update'];
$query = mysql_query("SELECT * FROM transaction where id = '$id'") or die ("could not search");
$count = mysql_num_rows($query);
while ($rows = mysql_fetch_array($query)) {
$id = $rows['id'];
$tranid = $rows['tranid'];
$trandate = $rows['trandate'];
$patientid = $rows['patientid'];
$transactiontype = $rows['transactiontype'];
$trandescription = $rows['trandescription'];
$tranquantity = $rows['tranquantity'];
$tranunitprice = $rows['tranunitprice'];
$tranamount =$rows['tranamount'];
$gettrandescription = $rows['trandescription'];
}
}
if (isset($_POST['selectmedicine'])) {
$gettrandescription=$_POST['medicineid'];
}
if (isset($_POST['selectroomquantity'])) {
$tranquantity=$_POST['quantity'];
}
?>
<script type="text/javascript">
$('#collapseone').collapseone({
toggle: true
});
</script>
<option value="<?php echo $trandescription; ?>" <?php if($trandescription==$gettrandescription){ echo "selected";} ?> ><?php echo $gettrandescription; ?></option>
<option value="<?php echo $tranquantity; ?>" <?php if($tranquantity==$tranquantity){ echo "selected";} ?> ><?php echo $tranquantity; ?></option>
<form action="billindex.php" method="POST">
<input type="hidden" name="id" value="<?php echo "$id"; ?>">
<input type="hidden" name="tranid" value="<?php echo "$tranid"; ?>">
<input type="hidden" name="patientid" value="<?php echo "$patientid"; ?>">
<input type="hidden" name="trandate" value="<?php echo "$trandate"; ?>">
<input type="hidden" name="transactiontype" value="<?php echo "$transactiontype"; ?>">
<input type="hidden" name="trandescription" value="<?php echo "$trandescription"; ?>">
<input type="hidden" name="tranquanity" value="<?php echo "$tranquantity"; ?>">
<input type="hidden" name="tranunitprice" value="<?php echo "$tranunitprice"; ?>">
<input type="hidden" name="tranamount" value="<?php echo "$tranamount"; ?>">
<input type="submit" name="update" value="Update">
</form>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingTwo">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Medicine
</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
<div class="panel-body">
<form action="transaction.php" method="POST">
<div class="col-md-6">
<div class="panel panel-info">
<div class="panel-heading"><h7>Medicine Type : </h7></div>
<div class="panel-body">
<select name="selectmedicine" class="form-control col-sm-4" id="medicinename">
<option id="0" style="width:100px"></option>
<?php
$medicine = mysql_query("SELECT * FROM medicine");
while ($row = mysql_fetch_array($medicine)) {
echo '<option id="' . $row['medicinename'] . '"';
echo ' value="' . $row['medicineid'] . '"';
if($row['medicineid'] == $row['medicinename']) {
echo ' selected="selected"';
}
echo '>';
echo $row['medicinename'];
echo '</option>';
}
?>
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-info">
<div class="panel-heading panel-height:20px":><h7>Quantity : </h7></div>
<div class="panel-body">
<select name="selectmedicinequantity" class="form-control col-md-4" id="quantityname">
<option id="0" style="width:100px"></option>
<?php
$medicinequantity = mysql_query("SELECT * FROM quantity");
while ($displayquantity = mysql_fetch_array($medicinequantity)) {
$quantityid = $displayquantity['id'];
$quantityname = $displayquantity['quantityname'];
//$quantityprice = $displayquantity['quantityprice'];
?>
<option id=" <?php echo $displayquantity['quantityid']; ?>"><?php if($displayquantity['quantityid'] == $displayquantity['quantityname']) echo 'selected="selected"'; ?><?php echo $displayquantity['quantityname'] ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>

some ?> appears in my page all tags opned are closed

I met some trouvle in my pages, some ?> ?> ?> ?> ?> ?> ?> does appears in my page, it seems lie the code is not interpreted, but all is closed and I do not know where it can comes from
below is my code
<?php
//For weight change
$down_icon = 'images/thumb_down.gif';
$same_icon = 'images/cool.gif';
$up_icon = 'images/thumb_up.gif';
$comment_icon = 'images/notebook.gif';
//DB Values for icons
$status_icons[0] = $down_icon;
$status_icons[1] = $same_icon;
$status_icons[2] = $up_icon;
?>
<style>
.fif {display: inline-block;
padding-left:5px;
padding-right: 5px;
/* box-shadow: 8px 8px 0px #aaa;
border-width:1px;
border-style:dashed;
border-color:black;}*/
}
</style>
<table class="noborder">
<tr><td>
<div class="uibutton-group">
<a class="uibutton" href="index.php?p=history&day=1">Lundi</a>
<a class="uibutton" href="index.php?p=history&day=2">Mardi</a>
<a class="uibutton" href="index.php?p=history&day=3">Mercredi</a>
<a class="uibutton" href="index.php?p=history&day=4">Jeudi</a>
<a class="uibutton" href="index.php?p=history&day=5">Vendredi</a>
<a class="uibutton" href="index.php?p=history&day=6">Samedi</a>
<a class="uibutton" href="index.php?p=history&day=7">Dimanche</a>
</div>
</td>
<td><b>Derniers jours en arrière </b> </td>
<td><div class="uibutton-group">
<a class="uibutton" href="index.php?p=history&day=<?php echo $_GET['day'] ?>&farback=30">30</a>
<a class="uibutton" href="index.php?p=history&day=<?php echo $_GET['day'] ?>&farback=60">60</a>
<a class="uibutton" href="index.php?p=history&day=<?php echo $_GET['day'] ?>&farback=90">90</a>
<a class="uibutton" href="index.php?p=history&day=<?php echo $_GET['day'] ?>&farback=120">120</a>
</div></td>
</tr>
</table><p><br></p>
<div class="maindivforexos" style="width:100%;display:inline-block">
<?php
if (!isset($_GET['day'])) {
$_GET['day'] = 1;
}
if (isset($_GET['farback'])) {
$farback = $_GET['farback'];
} else {
$farback = 28;
}
$query = "SELECT `record` FROM `workouts`
WHERE `workouts`.`day_number`='1'
AND `workouts`.`user` = {$_SESSION['userid']}
AND `workouts`.`record` >= SUBDATE(now(),INTERVAL {$farback} day)
GROUP BY `record` ";
$result = mysql_query($query);
if (!mysql_num_rows($result)):
?>
<div class=warning>Il n'y a pas d'enregistrements pour ce jour.</div>
<?php
else:
while ($cr = mysql_fetch_array($result)):
?>
<div style="width:200px" class="fif"><table style="width:100%">
<tr class="fbgreybox">
<td colspan="3" style="text-align: center;font-weight: bold">
<img src="images/calendar_2.png"> Séance du : <?php echo date('d-m-Y', strtotime($cr['record'])) ?>
</td>
</tr>
<?php
$sql = "SELECT `exercise` FROM `workouts` WHERE `record` = '{$cr['record']}' AND `user`= {$_SESSION['userid']} GROUP BY `exercise`";
$result = mysql_query($sql);
while ($exo = mysql_fetch_assoc($result)) :
?>
<tr class="fbinfobox">
<td colspan="3" style="text-align: left">
<img src="images/Sport-dumbbell.png"> <?php echo exerciseName($exo['exercise']) ?>
</td>
</tr>
<tr>
<td style="text-align: center;font-weight: bold">Séries</td>
<td style="text-align: center;font-weight: bold">Reps</td>
<td style="text-align: center;font-weight: bold">Poids</td>
</tr>
<?php
$rqt = "SELECT `set_number`, `reps`, `weight` FROM `workouts` WHERE `exercise` = {$exo['exercise']} AND `record` = '{$cr['record']}' AND `user` = {$_SESSION['userid']} ORDER BY `set_number`";
$result2 = mysql_query($rqt);
while ($detail = mysql_fetch_assoc($result2)):
?>
<tr>
<td>
Série <?php echo $detail['set_number'] ?>
</td>
<td>
<?php echo $detail['reps'] ?>
</td>
<td>
<?php echo $detail['weight'] ?>
</td>
</tr>
?>
<?php
endwhile;
endwhile;
?>
</table>
</div>
<?php
endwhile;
endif;
?>
</div>
I really have no Idead on where it can comes from because All tags opened are closed.
It appears between the div and the table in the loop
Anykind of help will be much appreciated
It looks like there is an extra closing PHP tag in your code.
<?php echo $detail['weight'] ?>
</td>
</tr>
?> <----------here

I cant display multiple results (even though the same exact code has worked for me in the past)

This is super strange.
I used a portion of code for a new project I was working on, and for some reason the results won't display correctly. (They display, just one at a time though)
It worked for me in the past and I really don't get why its not displaying like it should
(Maybe it has to do with the fact I took a yearlong hiatus from coding and PHP 5 is wayyy different from the version I was used to)
Here's the code
<?php
$search = $_GET['search'];
$sfrom = $_GET['departure_label'];
$sfromda = $_GET['txtdate1'];
$sto = $_GET['arrival_label'];
$stoda = $_GET['txtdate2'];
$padt = $_GET['ddlPaxADT'];
$pchd = $_GET['ddlPaxCHD'];
$pinf = $_GET['ddlPaxINF'];
$addition = $padt+$pchd+$pinf;
$currency = $_GET['Currency'];
//connect to database
mysql_connect("localhost","poop","goldpoop");
mysql_select_db("moregoldpoop");
//echo outconstruct
$sql = mysql_query("SELECT * FROM search_v WHERE Currency='$currency' AND rout_to='$sto' AND rout_from='$sfrom'ORDER BY date_avialable DESC");
$runrows = mysql_fetch_array($sql);
{
//get data
$flightid = $runrows['flight_id'];
$aseats = $runrows['seats_avialable'];
$todate = strftime("%b %d, %Y %l:%M %p" ,strtotime($runrows['to_date']));
$date = strftime("%b %d, %Y %l:%M %p" ,strtotime($runrows['date_avialable']));
$from = $runrows['rout_from'];
$to = $runrows['rout_to'];
$acost = $runrows['adult_cost'];
$ccost = $runrows['child_cost'];
$cur = $runrows['currency'];
$oth = $runrows['other_cost'];
echo "";
?>
<li class="item clearfix"> <span
id="cntntMiddle_ctl01_rptmain_lblFromt_0">
<table cellpadding="0" cellspacing="0">
<thead><tr>
<th class="price">Price</th>
<th>From</th>
<th>To</th>
<th>Depart</th>
</tr>
</thead><tfoot> <tr>
<td><a class="more" href="#">Full
Details</a></td>
<td colspan="6">
<div class="select-wrap">
<p class="seats"><strong><?php echo $aseats; ?></strong> <span>seats
left</span> <em>at this price</em></p>
<button class="btn-select" type="button"
onclick='return ray.ajax("#");'>Select Flight</button></div>
</td>
</tr>
</tfoot><tbody>
<tr>
<td class="price" rowspan="2"><a
style="font-weight: bold; cursor: pointer; text-decoration: none;"
herf="#" onclick='return ray.ajax("#");'><span
style="font-size: 24px; font-weight: bold;"><?php echo $acost; ?></span><span
style="font-size: 11px; margin-top: 2px; display: block; color: rgb(255, 255, 255); text-align: center; font-weight: normal;">per
adult</span><span
style="font-size: 12px; margin-top: 2px; display: block; color: rgb(255, 255, 255); text-align: center; font-weight: normal;">(with fees)</span></a></td>
<td><?php echo $from; ?></td>
<td><?php echo $to ?></td>
<td style="padding-right: 2px;"><?php echo $date; ?></td>
</tr>
</tbody>
</table>
</span> <a
id="cntntMiddle_ctl01_rptmain_lblResultDetails1_0" title="1"
href="javascript:__doPostBack('ctl00$cntntMiddle$ctl01$rptmain$ctl00$lblResultDetails1','')"
style="color: Black;"></a><a class="close"
href="#">Close</a>
<div class="info clearfix">
<div class="info clearfix">
<h4>Departing Flight</h4>
<ul class="clearfix">
<li>
<h5><?php echo $from; ?> to <?php echo $to; ?> <?php echo $date; ?></h5>
<ul>
<li> </li>
<li><strong>Flight #</strong> - <?php echo $flightid; ?></li>
<li><strong>Departure Time – </strong>
<?php echo $date; ?></li>
</ul>
</li>
</ul>
<ul>
<li style="padding-top: 5px;"><span
style="color: rgb(212, 22, 13); font-weight: bold; font-size: 11px; text-decoration: none;">
Fare Breakdown</span> </li>
</ul>
<table class="more">
<tbody>
<tr>
<th>Passenger</th>
<th>Fare</th>
<th> Taxes and Fees</th>
<th>Qty</th>
<th>Total Cost</th>
</tr>
</tbody><tbody>
<tr>
<td>Adult</td>
<td
style="color: rgb(100, 100, 100); font-size: 11px; font-weight: bold;"><?php echo $acost; ?></td>
<td><?php echo $oth; ?></td>
<td id="paxAdtTd">1</td>
<td><?php echo $acost; ?></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>Cost of Sale(<?php echo $cur; ?>)</td>
<td> </td>
<td
style="color: rgb(100, 100, 100); font-size: 14px; font-weight: bold;"><?php echo $acost; ?></td>
</tr>
</tbody>
</table>
<br />
<span style="font-weight: bold; padding-top: 10px;">
*Additional airline fees for baggage may apply</span>
<div class="select-wrap">
<p class="seats"><strong><?php echo $aseats; ?></strong> <span>seats
left</span> <em>at this price</em></p>
<button class="btn-select" type="button"
onclick='return ray.ajax("https://res.com/checkout.aspx?recommendation=1&subset=1&supplier=53&page=flightconfirm",1,this);'>Select
Flight</button></div>
</ul>
</div>
</div>
</li>
<?php
}
?>
I just wanna know the main reason why it worked before and not now
Thanks guys
Where is the loop? $runrows = mysql_fetch_array($sql); should be something like while ( $runrows = mysql_fetch_array($sql) )
The loop block is there {} but the loop isn't.

Code is working without any errors...except it won't display

The code I used doesn't give me any MySQL errors (which is good)
Except it won't display the results I was looking for (in the url bar it looks like this search.php?departure_label=Dar+Es+Salaam&arrival_label=Zanzibar&txtDate1=03%2F19%2F2012&txtDate2=03%2F20%2F2012&ddlPAxADT=1&ddlPaxCHD=0&ddlPaxINF=0&search=Submit which is what I wanted since it means all of the information was passed through)
It just displays a white screen
Here's the code
<?PHP
$button = $_GET['submit'];
$search = $_GET['search'];
$sfrom = $_GET['departure_label'];
$sfromda = $_GET['txtdate1'];
$sto = $_GET['arrival_label'];
$stoda = $_GET['txtdate2'];
$padt = $_GET['ddlPaxADT'];
$pchd = $_GET['ddlPaxCHD'];
$pinf = $_GET['ddlPaxINF'];
include "connection.php";
$result=mysql_query("SELECT * from search_v where rout_from like'".$sfrom."' and rout_to like'".$sto."' and DATE_FORMAT(date_avialable,'%Y-%m-%d') between'".$sfromda."' and '".$stoda."' LIMIT 10") or die(mysql_error());
while($runrows = mysql_fetch_assoc($result)){
$flightid = $runrows['flight_id'];
$aseats = $runrows['seats_avialable'];
$todate = strftime("%b %d, %Y %l:%M %p" ,strtotime($runrows['to_date']));
$date = strftime("%b %d, %Y %l:%M %p" ,strtotime($runrows['date_avialable']));
$from = $runrows['rout_from'];
$to = $runrows['rout_to'];
$acost = $runrows['adult_cost'];
$ccost = $runrows['child_cost'];
$cur = $runrows['currency'];
$oth = $runrows['other_cost'];
echo "";
?>
<li class="item clearfix"> <span
id="cntntMiddle_ctl01_rptmain_lblFromt_0">
<table cellpadding="0" cellspacing="0">
<thead><tr>
<th class="price">Price</th>
<th>From</th>
<th>To</th>
<th>Depart</th>
<th>Arrive</th>
</tr>
</thead><tfoot> <tr>
<td><a class="more" href="#">Full
Details</a></td>
<td colspan="6">
<div class="select-wrap">
<p class="seats"><strong><?php echo $aseats; ?></strong> <span>seats
left</span> <em>at this price</em></p>
<button class="btn-select" type="button"
onclick='return ray.ajax("#");'>Select Flight</button></div>
</td>
</tr>
</tfoot><tbody>
<tr>
<td class="price" rowspan="2"><a
style="font-weight: bold; cursor: pointer; text-decoration: none;"
herf="#" onclick='return ray.ajax("#");'><span
style="font-size: 24px; font-weight: bold;"><?php echo $totalcost; ?></span><span
style="font-size: 11px; margin-top: 2px; display: block; color: rgb(255, 255, 255); text-align: center; font-weight: normal;">per
adult</span><span
style="font-size: 12px; margin-top: 2px; display: block; color: rgb(255, 255, 255); text-align: center; font-weight: normal;">(with fees)</span></a></td>
<td><?php echo $from; ?></td>
<td><?php echo $to ?></td>
<td style="padding-right: 2px;">4:05 PM</td>
<td>7:05 PM</td>
</tr>
</tbody>
</table>
</span> <a
id="cntntMiddle_ctl01_rptmain_lblResultDetails1_0" title="1"
href="javascript:__doPostBack('ctl00$cntntMiddle$ctl01$rptmain$ctl00$lblResultDetails1','')"
style="color: Black;"></a><a class="close"
href="#">Close</a>
<div class="info clearfix">
<div class="info clearfix">
<h4>Departing Flight</h4>
<ul class="clearfix">
<li>
<h5><?php echo $from; ?> to <?php echo $to; ?> <?php echo $date; ?></h5>
<ul>
<li> </li>
<li><strong>Flight #</strong> - <?php echo $flightid; ?></li>
<li><strong>Departure Time – </strong>
6:05 PM</li>
<li><strong>Arrival Time</strong> - 5:05 PM</li>
</ul>
</li>
</ul>
<ul>
<li style="padding-top: 5px;"><span
style="color: rgb(212, 22, 13); font-weight: bold; font-size: 11px; text-decoration: none;">
Fare Breakdown</span> </li>
</ul>
<table class="more">
<tbody>
<tr>
<th>Passenger</th>
<th>Fare</th>
<th> Taxes and Fees</th>
<th>Qty</th>
<th>Total Cost</th>
</tr>
</tbody><tbody>
<tr>
<td>Adult</td>
<td
style="color: rgb(100, 100, 100); font-size: 11px; font-weight: bold;"><?php echo $acost; ?></td>
<td><?php echo $oth; ?></td>
<td id="paxAdtTd">1</td>
<td><?php echo $totaladult; ?></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td>Cost of Sale(<?php echo $cur; ?>)</td>
<td> </td>
<td
style="color: rgb(100, 100, 100); font-size: 14px; font-weight: bold;"><?php echo $totaladult; ?></td>
</tr>
</tbody>
</table>
<br />
<span style="font-weight: bold; padding-top: 10px;">
*Additional airline fees for baggage may apply</span>
<div class="select-wrap">
<p class="seats"><strong><?php echo $aseats; ?></strong> <span>seats
left</span> <em>at this price</em></p>
<button class="btn-select" type="button"
onclick='return ray.ajax("https://res.website.com/checkout.aspx?recommendation=1&subset=1&supplier=53&page=flightconfirm",1,this);'>Select
Flight</button></div>
<?php
}
?>
$result=mysql_query("SELECT * from search_v where rout_from like %'".$sfrom."'% and rout_to like %'".$sto."'% and DATE_FORMAT(date_avialable,'%Y-%m-%d') between'".$sfromda."' and '".$stoda."' LIMIT 10") or die(mysql_error());
there were two (logical?) errors, with LIKE function, you didn't use a wildcard % key, and in next LIKE occurance, for $sto you didn't provide a blankspace.

Categories