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>

The form has no action, so it's not sending anything anywhere. You'll need a page to act as "cart" and process/validate the selected flight there.

Also, do not use the deprecated and insecure mysql API, but instead use PDO or mysqli. You can find more information here.

There's also no reason to use $_REQUEST here, use $_POST instead and check if it is set or not.

@travevel i will appreciate if you can show me with the code, im still newbie to php. thanks

im still newbie to php

Then I suggest following a simple shopping cart tutorial like this one for instance and work your way up from there. It uses mysqli and covers the basics. You can download the files from the bottom there, but the best way of learning is by doing.

And if you just meant the action method part, I was referring to <form method="post" action="">. It's empty, so it won't post anywhere. From the tutorial: <form method="post" action="cart_update.php"> would post your form to cart_update.php. The logic for handling the form would reside there.

This is update of what i ve done so far but yet still not working, let me explain what i want to do very well, im working on a flight reservation website for my final year school project where users can search for available flight then give them the result from mysql
database, i am able to get the search result when the user search but the problem now is i want the user to select from the result to the cart then go to to where user will input the flight infomation then go to the payment. thanks
this is my index where user can search the flight:

<?php include('include/head.php'); ?>
<?php
error_reporting(0);
include("config.php");
?>
<?php
ob_start();
include("db.php");
if(isset($_POST['button'])!="")
{
    $flight_date=mysql_real_escape_string($_POST['flight_date']);
    $depart=mysql_real_escape_string($_POST['depart']);
//    $depart_time=mysql_real_escape_string($_POST['depart_time']);
    $destination=mysql_real_escape_string($_POST['destination']);
//    $dest_time=mysql_real_escape_string($_POST['dest_time']);
//    $economy=mysql_real_escape_string($_POST['economy']);
//    $business=mysql_real_escape_string($_POST['business']);
//    $tick=mysql_real_escape_string($_POST['tick']);
//    $b_seat=mysql_real_escape_string($_POST['b_seat']);
//    $flight_time=mysql_real_escape_string($_POST['flight_time']);
//    $flight_date=mysql_real_escape_string($_POST['flight_date']);
//    $flight_date=mysql_real_escape_string($_POST['return_date']);

    $update=mysql_query("INSERT INTO booking(flight_date,depart,destination,created)VALUES
                                      ('$flight_date','$depart','$destination',now())");

    if($update)
    {
        $msg="Successfully Updated!!";
        echo "<script type='text/javascript'>alert('$msg');</script>";
//        header('Location:search.php');
    }
    else
    {
        $errormsg="Something went wrong, Try again";
        echo "<script type='text/javascript'>alert('$errormsg');</script>";
//        header('Location:search.php');
    }
}
ob_end_flush();
?>


        <!-- TOP AREA -->
        <div class="top-area show-onload">
            <div class="bg-holder full">
                <div class="bg-mask"></div>
                <div class="bg-img" style="background-image:url(img/2048x1365.png);"></div>
                <video class="bg-video hidden-sm hidden-xs" preload="auto" autoplay="true" loop="loop" muted="muted" poster="img/video-bg.jpg">
                    <source src="media/loop.webm" type="video/webm" />
                    <source src="media/loop.mp4" type="video/mp4" />
                </video>
                <div class="bg-content">
                    <div class="container">
                        <div class="row">
                            <div class="col-md-5 col-md-offset-7">
                                <!-- START TESTIMONIAL -->
                                <!--<div class="testimonial text-white mt50 hidden-sm hidden-xs">-->
                                    <!--<div class="testimonial-inner">-->
                                        <!--<blockquote>-->
                                            <!--<p>Hendrerit pellentesque ligula mus mollis himenaeos class lorem nam sociis congue quis imperdiet ornare elementum</p>-->
                                        <!--</blockquote>-->
                                    <!--</div>-->
                                    <!--<div class="testimonial-author">-->
                                        <!--<img src="img/50x50.png" alt="Image Alternative text" title="Gamer Chick" />-->
                                        <!--<p class="testimonial-author-name">Elizabeth Wallace</p><cite>on <a class="text-udl" href="#">The Benjamin</a> hotel in New York</cite>-->
                                    <!--</div>-->
                                <!--</div>-->
                                <!-- END TESTIMONIAL -->
                            </div>
                        </div>
                    </div>
                </div>
                <div class="bg-front full-height">
                    <div class="container rel full-height">
                        <div class="search-tabs search-tabs-bg search-tabs-bottom">
                            <div class="tabbable">
                                <ul class="nav nav-tabs" id="myTab">

                                    <li class="active"><a href="#tab-1" data-toggle="tab"><i class="fa fa-plane"></i> <span >Flights</span></a>
                                    </li>

                                </ul>
                                <div class="tab-content">

                                    <div class="tab-pane fade in active" id="tab-1">
                                        <h2>Search for Flights</h2>

<!--                                        <form id="form1" name="form1" method="post" action="search.php">-->
<!--                                            <label for="from">From</label>-->
<!--                                            <input name="from" type="text" id="from" size="10" value="--><?php //echo $_REQUEST["from"]; ?><!--" />-->
<!--                                            <label for="to">to</label>-->
<!--                                            <input name="to" type="text" id="to" size="10" value="--><?php //echo $_REQUEST["to"]; ?><!--"/>-->
<!--                                            <label>Name or Email:</label>-->
<!--                                            <input type="text" name="string" id="string" value="--><?php //echo stripcslashes($_REQUEST["string"]); ?><!--" />-->
<!--                                            <label>City</label>-->
<!--                                            <select name="city">-->
<!--                                                <option value="">--</option>-->
<!--                                                --><?php
//                                                $sql = "SELECT * FROM ".$SETTINGS["morning_table"]." GROUP BY depart ORDER BY depart";
//                                                $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
//                                                while ($row = mysql_fetch_assoc($sql_result)) {
//                                                    echo "<option value='".$row["depart"]."'".($row["depart"]==$_REQUEST["depart"] ? " selected" : "").">".$row["depart"]."</option>";
//                                                }
//                                                ?>
<!--                                            </select>-->
<!--                                            <input type="submit" name="button" id="button" value="Filter" />-->
<!--                                            </label>-->
<!--                                            <a href="search.php">-->
<!--                                                reset</a>-->
<!--                                        </form>-->







                                        <form method="post" action="search.php">
                                            <div class="tabbable">
                                                <ul class="nav nav-pills nav-sm nav-no-br mb10" id="flightChooseTab">
                                                    <li class="active"><a href="#flight-search-1" data-toggle="tab">Round Trip</a>
                                                    </li>
                                                    <li><a href="#flight-search-2" data-toggle="tab">One Way</a>
                                                    </li>
                                                </ul>
                                                <div class="tab-content">
                                                    <div class="tab-pane fade in active" id="flight-search-1">
                                                        <div class="row">
                                                            <div class="col-md-6">
                                                                <div class="row">
                                                                    <div class="col-md-6">
<!--                                                                        <div class="form-group form-group-lg form-group-icon-left"><i class="fa fa-map-marker input-icon"></i>-->
<!--                                                                            <label>From</label>-->
<!--                                                                            <input class="typeahead form-control" placeholder="Accra, Ghana" type="text" />-->
<!--                                                                        </div>-->

                                                                        <div class="form-group form-group-lg form-group-icon-left"><i class="fa fa-map-marker input-icon"></i>
                                                                            <label for="depart">From</label>
                                                                            <select name="depart" class="form-control" id="category">
<!--                                                                                <option value="">--</option>-->-->
<!--                                                                                --><?php
//                                                                                include('db.php');
//                                                                                $result = mysql_query("SELECT * FROM morning");
//                                                                                while($row = mysql_fetch_assoc($result))
//                                                                                {
//                                                                                    echo '<option value="'.$row['depart'].'">';
//                                                                                    echo $row['depart'].' ';
//                                                                                    echo '</option>';
//                                                                                }
//                                                                                ?>
                                                                                <option value="">--</option>
                                                                                <?php
                                                                                $sql = "SELECT * FROM ".$SETTINGS["morning_table"]." GROUP BY depart ORDER BY depart";
                                                                                $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
                                                                                while ($row = mysql_fetch_assoc($sql_result)) {
                                                                                    echo "<option value='".$row["depart"]."'".($row["depart"]==$_REQUEST["depart"] ? " selected" : "").">".$row["depart"]."</option>";
                                                                                }
                                                                                ?>
                                                                            </select>
                                                                        </div>
                                                                    </div>

                                                                    <div class="col-md-6">
<!--                                                                        <div class="form-group form-group-lg form-group-icon-left"><i class="fa fa-map-marker input-icon"></i>-->
<!--                                                                            <label>To</label>-->
<!--                                                                            <input class="typeahead form-control" placeholder="Kumasi, Ghana" type="text" />-->
<!--                                                                        </div>-->
                                                                        <div class="form-group form-group-lg form-group-icon-left"><i class="fa fa-map-marker input-icon"></i>
                                                                            <label for="destination">To</label>
                                                                            <select name="destination" class="form-control" id="category">
                                                                                <option value="">--</option>
                                                                                <?php
                                                                                $sql = "SELECT * FROM ".$SETTINGS["morning_table"]." GROUP BY destination ORDER BY destination";
                                                                                $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
                                                                                while ($row = mysql_fetch_assoc($sql_result)) {
                                                                                    echo "<option value='".$row["destination"]."'".($row["destination"]==$_REQUEST["destination"] ? " selected" : "").">".$row["destination"]."</option>";
                                                                                }
                                                                                ?>
                                                                            </select>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6">
                                                                <div class="input-daterange" data-date-format="M d, D">
                                                                    <div class="row">
                                                                        <div class="col-md-4">
                                                                            <div  class="form-group form-group-lg form-group-icon-left"><i class="fa fa-calendar input-icon input-icon-highlight"></i>
                                                                                <label>Departing</label>
                                                                                <input name="flight_date" id="from" size="10" value="<?php echo $_REQUEST["from"]; ?>" class="date-pick form-control"  type="text" />
                                                                            </div>
                                                                        </div>
                                                                        <div class="col-md-4">
                                                                            <div class="form-group form-group-lg form-group-icon-left"><i class="fa fa-calendar input-icon input-icon-highlight"></i>
                                                                                <label for="to">Returning</label>
                                                                                <input name="to" type="text" id="to" size="10" value="<?php echo $_REQUEST["to"]; ?>" class="date-pick form-control"  />
                                                                            </div>
                                                                        </div>
                                                                        <div class="col-md-4">
                                                                            <div class="form-group form-group-lg form-group-select-plus">
                                                                                <label>Passengers</label>
                                                                                <select class="form-control" id="category">
                                                                                    <option selected="selected">1</option>
                                                                                    <option>2</option>
                                                                                    <option>3</option>
                                                                                    <option >4</option>
                                                                                    <option>5</option>
                                                                                    <option>6</option>
                                                                                    <option>7</option>
                                                                                    <option>8</option>
                                                                                    <option>9</option>
                                                                                    <option>10</option>
                                                                                    <option>11</option>
                                                                                    <option>12</option>
                                                                                    <option>13</option>
                                                                                    <option>14</option>
                                                                                </select>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="tab-pane fade" id="flight-search-2">
                                                        <div class="row">
                                                            <div class="col-md-6">
                                                                <div class="row">
                                                                    <div class="col-md-6">
<!--                                                                        <div class="form-group form-group-lg form-group-icon-left"><i class="fa fa-map-marker input-icon"></i>-->
<!--                                                                            <label>From</label>-->
<!--                                                                            <input class="typeahead form-control" placeholder="Kumasi, Ghana" type="text" />-->
<!--                                                                        </div>-->
                                                                        <div class="form-group form-group-lg form-group-icon-left"><i class="fa fa-map-marker input-icon"></i>
                                                                            <label for="category">From</label>
                                                                            <select class="form-control" id="category">
                                                                                <option selected="selected">Accra</option>
                                                                                <option>Kumasi</option>
                                                                                <option>Lagos</option>
                                                                            </select>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-6">
<!--                                                                        <div class="form-group form-group-lg form-group-icon-left"><i class="fa fa-map-marker input-icon"></i>-->
<!--                                                                            <label>To</label>-->
<!--                                                                            <input class="typeahead form-control" placeholder="Accra, Ghana" type="text" />-->
<!--                                                                        </div>-->
                                                                        <div class="form-group form-group-lg form-group-icon-left"><i class="fa fa-map-marker input-icon"></i>
                                                                            <label for="category">To</label>
                                                                            <select class="form-control" id="category">
                                                                                <option>Accra</option>
                                                                                <option selected="selected">Kumasi</option>
                                                                                <option>Lagos</option>
                                                                            </select>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-6">
                                                                <div class="input-daterange" data-date-format="M d, D">
                                                                    <div class="row">
                                                                        <div class="col-md-4">
                                                                            <div class="form-group form-group-lg form-group-icon-left"><i class="fa fa-calendar input-icon input-icon-highlight"></i>
                                                                                <label>Departing</label>
                                                                                <input class="date-pick form-control" data-date-format="M d, D" type="text" />
                                                                            </div>
                                                                        </div>
<!--                                                                        <div class="col-md-4">-->
<!--                                                                            <div class="form-group form-group-lg form-group-icon-left"><i class="fa fa-calendar input-icon input-icon-highlight"></i>-->
<!--                                                                                <label>Returning</label>-->
<!--                                                                                <input class="form-control" name="end" type="text" />-->
<!--                                                                            </div>-->
<!--                                                                        </div>-->
                                                                        <div class="col-md-4">
                                                                            <div class="form-group form-group-lg form-group-select-plus">
                                                                                <label>Passngers</label>
                                                                                <div class="btn-group btn-group-select-num" data-toggle="buttons">
                                                                                    <label class="btn btn-primary active">
                                                                                        <input type="radio" name="options" />1</label>
                                                                                    <label class="btn btn-primary">
                                                                                        <input type="radio" name="options" />2</label>
                                                                                    <label class="btn btn-primary">
                                                                                        <input type="radio" name="options" />3</label>
                                                                                    <label class="btn btn-primary">
                                                                                        <input type="radio" name="options" />3+</label>
                                                                                </div>
                                                                                <select class="form-control hidden">
                                                                                    <option>1</option>
                                                                                    <option>2</option>
                                                                                    <option>3</option>
                                                                                    <option selected="selected">4</option>
                                                                                    <option>5</option>
                                                                                    <option>6</option>
                                                                                    <option>7</option>
                                                                                    <option>8</option>
                                                                                    <option>9</option>
                                                                                    <option>10</option>
                                                                                    <option>11</option>
                                                                                    <option>12</option>
                                                                                    <option>13</option>
                                                                                    <option>14</option>
                                                                                </select>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <button class="btn btn-primary btn-lg" name="button" id="button" type="submit"  value="Filter">Search Flight</button>
                                        </form>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- END TOP AREA  -->

        <div class="gap"></div>


        <div class="container">
            <div class="text-center row">
                <div class="col-md-8 col-md-offset-2">
                    <div class="row row-wrap" data-gutter="60">
                        <div class="col-md-4">
                            <div class="thumb">
                                <header class="thumb-header"><i class="fa fa-dollar box-icon-gray box-icon-center round box-icon-border box-icon-big animate-icon-top-to-bottom"></i>
                                </header>
                                <div class="thumb-caption">
                                    <h5 class="thumb-title"><a class="text-darken" href="#">Best Price Guarantee</a></h5>
                                    <p class="thumb-desc">Facilisis sollicitudin dolor dignissim pulvinar ultrices nullam vel ultricies phasellus</p>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="thumb">
                                <header class="thumb-header"><i class="fa fa-lock box-icon-gray box-icon-center round box-icon-border box-icon-big animate-icon-top-to-bottom"></i>
                                </header>
                                <div class="thumb-caption">
                                    <h5 class="thumb-title"><a class="text-darken" href="#">Trust & Safety</a></h5>
                                    <p class="thumb-desc">Risus porttitor dignissim nibh purus ornare imperdiet nullam convallis mattis</p>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="thumb">
                                <header class="thumb-header"><i class="fa fa-send box-icon-gray box-icon-center round box-icon-border box-icon-big animate-icon-top-to-bottom"></i>
                                </header>
                                <div class="thumb-caption">
                                    <h5 class="thumb-title"><a class="text-darken" href="#">Best Destinations</a></h5>
                                    <p class="thumb-desc">Sollicitudin enim ad mauris lacus lectus a iaculis lorem pellentesque</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="gap gap-small"></div>
        </div>



        </div>

    <div class="gapp"></div>
<!--    <script>-->
<!--        $(function() {-->
<!--            var dates = $( "#from, #to" ).datepicker({-->
<!--                defaultDate: "+1w",-->
<!--                changeMonth: true,-->
<!--                numberOfMonths: 2,-->
<!--                dateFormat: 'yyyy-mm-dd',-->
<!--                onSelect: function( selectedDate ) {-->
<!--                    var option = this.id == "from" ? "minDate" : "maxDate",-->
<!--                        instance = $( this ).data( "datepicker" ),-->
<!--                        date = $.datepicker.parseDate(-->
<!--                            instance.settings.dateFormat ||-->
<!--                            $.datepicker._defaults.dateFormat,-->
<!--                            selectedDate, instance.settings );-->
<!--                    dates.not( this ).datepicker( "option", option, date );-->
<!--                }-->
<!--            });-->
<!--        });-->
<!--    </script>-->
<?php include('include/foot.php'); ?>

then my searcg.php

<?php include('include/head.php'); ?>
<?php
error_reporting(0);
include("config.php");
?>
<?php include('db.php'); ?>

<?Php
session_start();
?>

        <div class="container">

            <h3 class="booking-title">12 Flights from London to New York on Mar 22 for 1 adult <small><a class="popup-text" href="#search-dialog" data-effect="mfp-zoom-out"></a></small></h3>
            <div class="row">
                <div class="col-md-3">
                    <form class="booking-item-dates-change mb30">
                        <div class="form-group form-group-icon-left"><i class="fa fa-map-marker input-icon input-icon-hightlight"></i>
                            <label>From</label>
                            <input class="typeahead form-control" value="Great Britan, London" placeholder="City, Hotel Name or U.S. Zip Code" type="text" />
                        </div>
                        <div class="form-group form-group-icon-left"><i class="fa fa-map-marker input-icon input-icon-hightlight"></i>
                            <label>To</label>
                            <input class="typeahead form-control" value="United States, New York" placeholder="City, Hotel Name or U.S. Zip Code" type="text" />
                        </div>
                        <div class="form-group form-group-icon-left"><i class="fa fa-calendar input-icon input-icon-hightlight"></i>
                            <label>Departing</label>
                            <input class="date-pick form-control" data-date-format="MM d, D" type="text" />
                        </div>
                        <div class="form-group form-group-select-plus">
                            <label>Passengers</label>
                            <div class="btn-group btn-group-select-num" data-toggle="buttons">
                                <label class="btn btn-primary active">
                                    <input type="radio" name="options" />1</label>
                                <label class="btn btn-primary">
                                    <input type="radio" name="options" />2</label>
                                <label class="btn btn-primary">
                                    <input type="radio" name="options" />3</label>
                                <label class="btn btn-primary">
                                    <input type="radio" name="options" />4</label>
                                <label class="btn btn-primary">
                                    <input type="radio" name="options" />4+</label>
                            </div>
                            <select class="form-control hidden">
                                <option>1</option>
                                <option>2</option>
                                <option>3</option>
                                <option>4</option>
                                <option selected="selected">5</option>
                                <option>6</option>
                                <option>7</option>
                                <option>8</option>
                                <option>9</option>
                                <option>10</option>
                                <option>11</option>
                                <option>12</option>
                                <option>13</option>
                                <option>14</option>
                            </select>
                        </div>
                        <input class="btn btn-primary" type="submit" value="Update Search" />
                    </form>
                    <aside class="booking-filters text-white">
                        <h3>Filter By:</h3>
                        <ul class="list booking-filters-list">
                            <li>


                            </li>



                        </ul>
                    </aside>
                </div>
                <div class="col-md-9">


                    <?Php
                    $_SESSION['cart']=array(); // Declaring session array
                    array_push($_SESSION['cart'],'flight_time'); // Items added to cart

                    echo "Number of Items in the cart = ".sizeof($_SESSION['cart'])." <a href=cart-remove-all.php>Remove all</a><br>";
                    ?>
                    <!--                    <form method="post" enctype="multipart/form-data" action="booking_add.php">-->
                    <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" enctype="multipart/form-data" action="cart.php">
                                    <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" name="flight_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 name="depart" class="travel"><?php echo $row["depart"]; ?></h5>
                                                    <p name="depart_time" 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 name="destination" class="travel"><?php echo $row["destination"]; ?></h5>
                                                    <p name="dest_time"  value="" class="booking-item-date"> <?php echo $row["flight_time"]; ?></p>
                                                    <p class="booking-item-destination"></p>
                                                </div>
                                            </div>
                                        </div>
                                        <div name="business" 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>-->
                                            <input type="radio" name="tick" value="business">
                                        </div>
                                        <div name="economy" 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>
                                            <input type="radio" name="tick" value="economy">
                                            <a href=search.php>Cart adding</a> . <a href=cart.php>Display Items</a>
                                        </div>

                                    </div>

                                </div>
                            </div>
                        </li>



    <?php
    }
} else {
?>


                        <tr><td colspan="5">No Flight Found</td>
                            <?php
                            }
                            ?>



        </ul>


                        <button class="btn btn-primary btn-lg" type="submit" name="send"  value="Filter">Next</button>
                       </form>
                       </div>




                </div>
            </div>
            <div class="gap"></div>
        </div>

<?php include('include/foot.php'); ?>

and my cart.php

<?Php
session_start();
?>
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>

<head>
    <title></title>
</head>

<body>
<?Php
echo "Number of Items in the cart = ".sizeof($_SESSION['cart'])." <a href=cart-remove-all.php>Remove all</a><br>";
while (list ($key, $val) = each ($_SESSION['cart'])) {
    echo "$key -> $val <br>";
}

?>


</body>
</html>

pls i really need your complete and full supports guys, it is for my final year school project. pls help me. thanks

@traevel i tried the tutorial u refer me but still not add to cart.

still not add to cart

    <?Php
        $_SESSION['cart']=array(); // Declaring session array
        array_push($_SESSION['cart'],'flight_time'); // Items added to cart
        echo "Number of Items in the cart = ".sizeof($_SESSION['cart'])." ";
    ?>

Does that not result in a 1 being printed? You've added the word 'flight_time' to the cart. But, you're doing it inside the search page itself, not via a post to the update-cart page.

From the tutorial:

 <form method="post" action="cart_update.php">

This line would be in the search page, it will post all the form contents to cart_update.php. Then, in cart_update.php you will do things like:

foreach($_POST["product_qty"] as $key => $value){
    if(is_numeric($value)){
        $_SESSION["cart_products"][$key]["product_qty"] = $value;
    }
}

for instance to add a $_POST variable called 'product quantity' (sent by the search page) to the session cart.

it doesnt work still but if i code it without the search string, it work but if i search with string it does not add to cart, pls i need ur help guys. thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.