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 7489703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:21:25+00:00 2026-05-29T15:21:25+00:00

this is going to drive me mad, because its probably something I have missed

  • 0

this is going to drive me mad, because its probably something I have missed but I have a form that the user selects a country and a league name, and returns a table of the found results.

The problem I am having is that if that search form is submitted it returns nothing, but if I just refresh the page as normal with no submit it works fine and returns all the results. As you can see below it sets the $subleaguesearch and $countrysearch variables if the form has not been submitted and thats working fine, its just when it has been submitted that is not, and I just can’t seem to find why. Any help would be great! thanks.

p.s I am receiving no error message its just not returning anything at all. And I have echoed the variables back to screen after the form submittion and they echoed back with the correct values so I know the variables are being set ok!.

       <form action="" method="post" autocomplete="off">
        <table id="searchsubleaguetable" width="670px" align="left" cellpadding="1" cellspacing="0">    
                    <tr colspan="2">
                    <th colspan="2" align="left"><label>SEARCH SUBLEAGUES</th>
                    </tr>
                    <tr>
                    <td align="right"><label>COUNTRY&nbsp;&nbsp;</td>
                    <td align="left"><SELECT NAME="country" style="font-size:12px; padding:4px;"><OPTION VALUE="0">All Countries<?php echo $options;?></option></SELECT></label></td>
                    </tr>
                    <tr>
                    <td align="right"><label>SEARCH&nbsp;&nbsp;</td>
                    <td align="left"><input class="searchinputs" type="text" name="subleaguesearch" size="40" value=""></label></td>
                    </tr>
                    <tr width="100%" height="20px" colspan="2">
                    <td align="right"><label></td>
                    <td align="left"><input class="searchbutton" type="submit" value="Search" name="searchsubnow"></label></td>
                    </tr>
                </table>
            </form>




      if (isset($_POST['searchsubnow'])){
           $subleaguesearch = mysql_real_escape_string($_POST['country']);
           $countrysearch = mysql_real_escape_string($_POST['subleaguesearch']);        
           if($countrysearch == 0){
           $countrysearch = "%%";
           }
        }else{
           $subleaguesearch = "";
           $countrysearch = "%%";
        }

        $rowsPerPage = 15;
        $pageNum = 1;

        if(isset($_GET['page'])){
            $chosenpage = mysql_real_escape_string($_GET['page']);
            $pageNum = $chosenpage;
        }

        $offset = ($pageNum - 1) * $rowsPerPage;

        $result = mysql_query(" SELECT s.league_id, s.leaguename, s.private, s.date, u.flag, u.firstname, u.country,
                                COALESCE(SUM(r.total_points),0) as totalpoints,
                                count(m.member_id) participants
                                from sub_leagues s
                                Left Join members_leagues m
                                On m.league_id = s.league_id  
                                Left Join member_results r
                                On r.member_id = m.member_id
                                join members u
                                on s.admin = u.member_id
                                WHERE u.country LIKE '$countrysearch'
                                AND s.leaguename LIKE '$subleaguesearch%'
                                Group By s.league_id
                                Order By r.total_points DESC, participants DESC, s.date ASC " . " LIMIT $offset, $rowsPerPage") 
                        or die ("<br/>&nbsp;Error - could not display league");
  • 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-29T15:21:25+00:00Added an answer on May 29, 2026 at 3:21 pm

    Imagining you problem is in this code:

    $subleaguesearch = mysql_real_escape_string($_POST['country']);
    $countrysearch = mysql_real_escape_string($_POST['subleaguesearch']);        
    if($countrysearch == 0){
       $countrysearch = "%%";
    }
    

    First, you should check and make sure that $_POST[‘country’] and $_POST[‘subleaguesearch’] contain what you think they contain. If they do not, then you named the field in your form wrong most likely.

    Second, it seems that you have assigned the wrong post fields to the wrong search variables. Notice $subleaguessearch = $_POST[‘country’] instead of equaling $_POST[‘subleaguesearch’]. same with $countrysearch. So instead it should be something like:

    $subleaguesearch = mysql_real_escape_string($_POST['subleaguesearch ']);
    $countrysearch = mysql_real_escape_string($_POST['country']);  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm guessing this is going to involve regexp or something, but I'll give it
I have a Windows Form application. What this application does, is let the user
This is going to sound like a silly question, but I'm still learning C,
This is going to be the noobist of all noob questions, but what exactly
This is going to be hard to explain but I'll try my best. I
This is going to sound too silly / too basic - sorry about that,
Initially I thought this was going to work, but now I understand it won't
In my application, the user selects a big file (>100 mb) on their drive.
This question is not about timing something accurately on Windows (XP or better), but
This is going to be a little tricky to explain. I'm trying to write

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.