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

  • Home
  • SEARCH
  • 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 6904559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:04:35+00:00 2026-05-27T08:04:35+00:00

I have a site that displays data on travel products from a MySQL database.

  • 0

I have a site that displays data on travel products from a MySQL database. There are radio buttons above for the user to choose if they want to display the results in ascending price order or descending price order.

This was working fine with until I tried to make it look neater on the page by putting it in a table. I also had to change the ‘name’ tags so that they were both the same so that the user couldn’t select both the ascending and descending options and mess up the query. I think one of these contributed to messing it up.

It used to sort the items by price perfectly when the user clicked the appropriate radio button and then the search button next to it. But now it doesn’t do anything. Much appreciated if someone could help. Probably a simple error.

HTML:

<form action="ayia-napa-holidays.php" method="get">
            <table width="280" height="25" >

                <tr><td width="61"><p>Sort by:</p></td>
                <td width="72" height="24"><p>Lowest price</p></td>
                <td width="28"><input name="priceorder" type="radio" value="priceorderasc" /></td>

                <td width="75" height="24"><p>Highest price</p></td>
                <td width="20"><input name="priceorder" type="radio" value="priceorderdesc" /></td>

            </tr></table>
            <input name="searchform1" type="submit" value="Search" class="moreinfobutton" />
            </form>

PHP:

<?php 

            //connect
                include ("db.connect.php");

                $pages_query = mysql_query("SELECT COUNT('id') FROM `holidaytable` WHERE brandname = 'Cyprus'");
                $count = mysql_result($pages_query, 0);


                echo '<p>There are '.$count.' holidays<hr></p>';                    
                //construct query and insert values

                $sql = "SELECT * FROM holidaytable WHERE brandname = 'Cyprus'";


                if (isset($_GET['priceorderasc'])) $sql .= " ORDER BY buynow ASC";
                if (isset($_GET['priceorderdesc'])) $sql .= " ORDER BY buynow DESC";


                $query = mysql_query($sql) or die(mysql_error());

            include("dbresults.php");

        ?>
  • 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-05-27T08:04:35+00:00Added an answer on May 27, 2026 at 8:04 am

    The get name is $_GET['priceorder'] (saying your using the GET method on the <from> for the Radios. So, you will need something like this, using your current code:

    if(isset($_GET['priceorder']) && !empty($_GET['priceorder']))
    {
      if ($_GET['priceorder'] == 'priceorderasc') $sql .= " ORDER BY buynow ASC";
      if ($_GET['priceorder'] == 'priceorderdesc') $sql .= " ORDER BY buynow DESC";
    }
    

    No need to check if it is set twice, empty check is just a backup and optional.

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

Sidebar

Related Questions

I am working on a site which displays products from a database in a
I have a page that displays data which is read from a cookie. The
I have a site that displays user input by decoding it to unicode using
I have a site that displays other sites through an iframe on certain pages.
Another lame question So, I have a site that displays several students' requests to
i would like to have a block on my drupal site(latest version) that displays
I have a site that has a /sites/default/files/ directory where user content is typically
I'm developing a site that will display confidential readonly information, with data fetched from
I'm trying to make a site that loads values from a database and then
I've made a site that displays a user's Facebook photos. The code below appends

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.