Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7925147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:09:25+00:00 2026-06-03T18:09:25+00:00

So I have a search form, and when the search result page loads, there

  • 0

So I have a search form, and when the search result page loads, there are some jump menu’s at the top to allow a user to narrow down the results.

The jump menu’s show the selected search criteria from the posted form.

However, in the ‘Ports’ jump menu, if you choose Bristol or Edinburgh, when you land on the results page, the ports menu doesn’t show them as selected. It does for all the others…

Here’s my search select code from the cruise search box

<select name="port" id="port">
<option selected value="%">All Ports...</option>
<option value="Bristol Avonmouth">Bristol Avonmouth</option>
<option value="Edinburgh Leith">Edinburgh Leith</option>
<option value="Glasgow Greenock">Greenock</option>
<option value="Hull">Hull</option>
<option value="Liverpool">Liverpool</option>
<option value="London, Tilbury">London Tilbury</option>
<option value="Newcastle">Newcastle</option>
</select>

and here’s the jump menu code on the results page

<div id="cac">
    <h3>Sailing from...</h3>
    <p>&nbsp;</p>
    <p>
    <select name="jumpMenu3" id="jumpMenu3" onchange="MM_jumpMenu('parent',this,0)">
    <option value="">Select a port</option>
    <?php
    $ports = array(); 
    mysql_data_seek($cruises, 0);
    while ($row_cruises = mysql_fetch_assoc($cruises)) { 
    if (!in_array($row_cruises['fromport'], $ports)) {
        $ports[] = $row_cruises['fromport'];
    ?>
    <option value="index.php?subj=2&destination=<?php echo urlencode($row_cruises['destination']);?>&departs=<?php echo date('Ym',strtotime($row_cruises['departs']));?>&port=<?php echo urlencode($row_cruises['fromport']);?>"<?php if ($_GET['port'] == $row_cruises['fromport'] OR $_POST['port'] == $row_cruises['fromport']) {echo "selected=\"selected\"";}?>><?php echo $row_cruises['fromport']; ?></option>
    <?php } ;
    }
    if(mysql_num_rows($cruises) > 0) {
        mysql_data_seek($cruises, 0);
        $row_cruises = mysql_fetch_assoc($cruises);
    }
    ?>
    </select>

I’ve checked the ports themselves in the database for spelling, case, spacing… all good.

Maybe I need a like or wildcard comparison operator ?

doh doh doh

Fixed it – the port look up isn’t against the ports table, it’s against what written for the departure port in the cruises table, and there are some cruises that are entered wrong…

Rich 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T18:09:29+00:00Added an answer on June 3, 2026 at 6:09 pm

    Try replacing:
    if ($_GET['port'] == $row_cruises['fromport'] OR $_POST['port'] == $row_cruises['fromport'])
    with
    if ($_GET['port'] == urlencode($row_cruises['fromport']) OR $_POST['port'] == urlencode($row_cruises['fromport']))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my homepage I have a simple search form. The user can enter some
I have this page which loads quotes. It has a search form wherein if
I have a search form where user can search for products within their specified
(Using MySQL and PHP) I have a search form that will allow my users
what I have: a google search form (displayed on all pages) a wordpress page
i have a form in which if the user enters the search query, its
I have a search form.When user post the search form i take the user
I have a search page where every search result is added to the page
Hi I have a search results page which returns queries form the database using
I have a search form that, once submitted loads the results of the search

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.