hi guys pls i need your help, im having some problem to add to cart from a search strings in php with the following code, what i want is if i search for flight and the result and i want to add the result to cart
<div class="col-md-9">
<ul class="booking-list">
<?php
if ($_REQUEST["string"]<>'') {
$search_string = " AND (flight_date LIKE '%".mysql_real_escape_string($_REQUEST["string"])."'";
}
if ($_REQUEST["depart"]<>'') {
$search_city = " AND depart='".mysql_real_escape_string($_REQUEST["depart"])."'";
}
if ($_REQUEST["destination"]<>'') {
$search_destination = " AND destination='".mysql_real_escape_string($_REQUEST["destination"])."'";
}
if ($_REQUEST["flight_date"]<>'') {
$search_date = " AND flight_date='".mysql_real_escape_string($_REQUEST["flight_date"])."'";
}
if ($_REQUEST["from"]<>'' and $_REQUEST["to"]<>'') {
$sql = "SELECT * FROM ".$SETTINGS["morning_table"]." WHERE flight_date >= '".mysql_real_escape_string($_REQUEST["from"])."' AND return_date <= '".mysql_real_escape_string($_REQUEST["to"])."'".$search_string.$search_city.$search_destination.$search_date;
} else if ($_REQUEST["from"]<>'') {
$sql = "SELECT * FROM ".$SETTINGS["morning_table"]." WHERE flight_date >= '".mysql_real_escape_string($_REQUEST["from"])."'".$search_string.$search_city.$search_destination.$search_date;
}
else if ($_REQUEST["to"]<>'') {
$sql = "SELECT * FROM ".$SETTINGS["morning_table"]." WHERE return_date <= '".mysql_real_escape_string($_REQUEST["to"])."'".$search_string.$search_city.$search_destination.$search_date;
} else {
$sql = "SELECT * FROM ".$SETTINGS["morning_table"]." WHERE id>0".$search_string.$search_city.$search_destination;
}
$sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
if (mysql_num_rows($sql_result)>0) {
while ($row = mysql_fetch_assoc($sql_result)) {
?>
<li>
<div class="booking-item-container">
<div class="booking-item">
<form method="post" action="">
<div class="row">
<div class="col-md-2">
<div class="booking-item-airline-logo">
<img src="img/american-airlines.jpg" alt="Image Alternative text" title="Image Title" />
<h5 class="date"><?php echo $row["flight_date"]; ?></h5>
</div>
</div>
<div class="col-md-4">
<div class="booking-item-flight-details">
<div class="booking-item-departure"><i class="fa fa-plane"></i>
<h5 class="travel"><?php echo $row["depart"]; ?></h5>
<p class="booking-item-date"><?php echo $row["flight_time"]; ?></p>
<p class="booking-item-destination"></p>
</div>
<div class="booking-item-arrival"><i class="fa fa-plane fa-flip-vertical"></i>
<h5 class="travel"><?php echo $row["destination"]; ?></h5>
<p class="booking-item-date"><?php echo $row["flight_time"]; ?></p>
<p class="booking-item-destination"></p>
</div>
</div>
</div>
<div class="col-md-3"><span class="booking-item-price"><?php echo $row["business"]; ?></span>
<h5>Class: Business</h5>
<a class="btn btn-primary" href="#">Select</a>
</div>
<div class="col-md-3"><span class="booking-item-price"><?php echo $row["economy"]; ?></span>
<!-- <p class="booking-item-flight-class">Class: Economy</p><a class="btn btn-primary" href="#">Select</a>-->
<h5>Class: Economy</h5>
<!-- <a class="btn btn-primary" href="#">Select</a>-->
<div><input type="text" name="quantity" value="1" size="5" />
<input type="submit" value="Add to cart" class="btnAddAction" /></div>
</div>
</div>
</form>
<!-- --><?php
// }
// }
// ?>
</div>
</div>
</li>
<?php
}
} else {
?>
<tr><td colspan="5">No Flight Found</td>
<?php
}
?>
<div> <a class="btn btn-primary" href="#">Next</a></div>
</ul>
</div>
</div>
</div>
<div class="gap"></div>
</div>