how i can make search in another page

how i can make search in another page and take form values to search page

if there is another suggest i listen
AHMED SAMYownerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zephyr_hex (Megan)DeveloperCommented:
You can take form values to another page by using POST or an AJAX call.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AHMED SAMYownerAuthor Commented:
i have this code need to ecute in another page or the same page if possible

<?php
            if($connect){
                if($_POST['Modify']){


                    error_reporting(E_ALL);
                    ini_set('display_errors', 1);

                    $Travel=$_POST['Travel'];
                    $Duration=$_POST['Duration'];
                    $cites=$_POST['cites'];
                    $themes=$_POST['themes'];
                    $Categories=$_POST['Categories'];
                    $rooms=$_POST['rooms'];
                    $Adults=$_POST['Adults'];
                    $children=$_POST['children'];
                    $agechildren=$_POST['agechildren'];

                    $sql11="SELECT * FROM packages WHERE Trip_Duration LIKE '%$Travel%' OR Trip_Duration LIKE '%$Duration%' OR Detailed_Itinerary LIKE '%$cites%' OR Detailed_Itinerary LIKE '%$themes%' OR HName1 LIKE '%$Categories%' OR HName2 LIKE '%$Categories%' OR Detailed_Itinerary LIKE '%$rooms%' OR Detailed_Itinerary LIKE '%$Adults%' OR Detailed_Itinerary LIKE '%$children%' ";

                    $packages = mysqli_query($connect,$sql11);

                    while ( $searchresult= mysqli_fetch_array($packages)) {

                        $pac_name1 = $searchresult['package_id'];
                        $sqlimg1 = "SELECT content FROM packages_image WHERE packageID='$pac_name1'";
                        $queryimg1 = mysqli_query($connect, $sqlimg1);
                        while ($resultimg1 = mysqli_fetch_array($queryimg1)) {
                            ?>
                            <div class="col-lg-6 portfolio-item">
                                <div class="card h-100">
                                    <a href="ViewDetails.php?id=<?php echo $searchresult['package_id']; ?>">
                                        <?php echo '<a href="#"><img src="data:image/png;base64,' . base64_encode($resultimg1['content']) . '" width="100%" height="350px"/></a>'; ?>
                                    </a>
                                    <div class="card-body">
                                        <h4 class="card-title">
                                            <a href="ViewDetails.php?id=<?php echo $searchresult['package_id']; ?>"><?php echo $searchresult['package_id']; ?></a>
                                        </h4>
                                        <h3 class="breadcrumb"
                                            style="color:#C00; text-align:center"><?php echo $searchresult['Package_Price']; ?> euro.</h3>
                                        <p class="card-text"><?php echo substr($searchresult['Detailed_Itinerary'], 0, 150) ?></p>
                                        <a href="ViewDetails.php?id=<?php echo $searchresult['package_id']; ?>" class="btn btn-primary">More
                                            Details</a>
                                    </div>
                                </div>
                            </div>
                            <?php
                        }
                    }

                }
            }

            ?>

Open in new window

0
Eddie ShipmanAll-around developerCommented:
So, you want to view the search results in another page? I understand that English is not your primary language but a little more explanation is needed.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

AHMED SAMYownerAuthor Commented:
ok i have this code java to excute select option value

<script type="text/javascript">
        $(document).ready(function() {
            $('#sortBy').change(function() {
                $.get('data.php', { sort: $(this).val() }, function(data) {
                    $('#response').html(data);
                });
            });
			// Trigger the change event when the page loads
    		$('#sortBy').trigger('change');
        }); 
        </script>

Open in new window


and other data.php file is

<?php 
error_reporting(E_ALL);
ini_set('display_errors', 1);

$dbh = new PDO("mysql:host=$localhost;dbname=$db_name", $db_users, $db_password);
$dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);

switch ($_GET['sort']):

    case "1":
        $sql = "SELECT * FROM packages ORDER BY Package_Price ASC";
        break;

    case "2":
        $sql = "SELECT * FROM packages ORDER BY Package_Price DESC";
        break;

    default:
        $sql = "SELECT * FROM packages ORDER BY Package_Price";

endswitch;

// Prepare the IMG query to be used later on
$imgQuery = $dbh->prepare("SELECT content FROM packages_image WHERE packageID = ? LIMIT 1");

// Execute the Packages query
$packages = $dbh->query($sql);

// Loop through the Package results
while ($package = $packages->fetch()): ?>

    <?php
    // Get the image data from the prepared query
    $imgQuery->execute(array($package->package_id));
    $imgData = $imgQuery->fetchColumn();
    ?>

        <div class="col-lg-6 portfolio-item">
            <div class="card h-100">
                <a href="ViewDetails.php?id=<?php echo $package->package_id ?>">
                  <?php  echo '<img src="data:image/jpeg;base64,'.base64_encode($imgData).'" width="100%" height="350px"/>'; ?>
                </a>
                <div class="card-body">
                    <h4 class="card-title">
                        <a href="ViewDetails.php?id=<?php echo $package->package_id ?>"><?php echo $package->package_name ?></a>
                    </h4>
                  <h3 class="breadcrumb" style="color:#C00; text-align:center"><?php echo $package->Package_Price ?> euro.</h3>
                    <p class="card-text"><?php echo substr($package->Detailed_Itinerary, 0, 150) ?></p>
                    <a href="ViewDetails.php?id=<?php echo $package->package_id ?>" class="btn btn-primary">More Details</a>
                </div>
            </div>
        </div>

<?php endwhile; ?>

Open in new window


i have div with inputs and submit button to make another search how can i do ??
0
Eddie ShipmanAll-around developerCommented:
Still not clear enough. We need explanation of what you want, not just code.
0
AHMED SAMYownerAuthor Commented:
i have div with inputs and submit button above this select element  to make another search how can i do without conflict results??
0
Eddie ShipmanAll-around developerCommented:
In none of your code do I see an element with the id response or the id sortBy
If you want us to fully understand what you need, one line answers that really do not show us isn't going to help.
0
AHMED SAMYownerAuthor Commented:
<div class="float-left">Packages Found : <span style="color:red"><?php echo $resultcount['COUNT(package_name)']; ?></span></div>
                    <div class="float-right" style="display:inline">
                        <style>
                        #duration{width:200px;}
                        </style>
                                    
                        <select id="sortBy" class="form-control" style="width:250px;">
                            <option value="2">Star Rating (1-5)</option>
                            <option value="1">Star Rating (5-1)</option>
                        </select>

       
                    </div>
                  </div>
        </div>
            <br>
        <br>
      <div class="container">

       <!-- Page Heading/Breadcrumbs -->

        <div class="row" id="response"></div>
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.