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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:44:07+00:00 2026-06-01T11:44:07+00:00

I want my search to focus on variables in the URL string. Currently it

  • 0

I want my search to focus on variables in the URL string. Currently it uses a form based search.

It uses this

<?php
    include('db.php');  // include your code to connect to DB.
    $tbl_name="mobile";     //your table name

$whereClauses = array(); 
if (! empty($_POST['Model'])) $whereClauses[] ="model='".mysql_real_escape_string($_POST['Model'])."'"; 
if (! empty($_POST['Mins'])) $whereClauses[] ="minutes='".mysql_real_escape_string($_POST['Mins'])."'"; 
if (! empty($_POST['Texts'])) $whereClauses[] ="texts='".mysql_real_escape_string($_POST['Texts'])."'"; 
if (! empty($_POST['Freegifts'])) $whereClauses[] ="free_gift='".mysql_real_escape_string($_POST['Freegifts'])."'"; 
if (! empty($_POST['Network'])) $whereClauses[] ="network_name='".mysql_real_escape_string($_POST['Network'])."'"; 
if (! empty($_POST['Merchant'])) $whereClauses[] ="merchant_category='".mysql_real_escape_string($_POST['Merchant'])."'"; 
$where = ''; 
if (count($whereClauses) > 0) { $where = ' WHERE '.implode(' AND ',$whereClauses); } 
$sql = mysql_query("SELECT * FROM $tbl_name".$where); 
?>

However, I have added this to my page:

<?php
    $model = $_GET['model']; //gets model from URL
    $mins = $_GET['mins']; //gets mins from URL
    $texts = $_GET['texts']; //gets mins from URL
    $freegift = $_GET['free-gift']; //gets mins from URL
    $network = $_GET['network']; //gets mins from URL
    $plan = $_GET['plan']; //gets mins from URL
?>

It needs to be so not all variables are required. Any help would be appreciated.

Thanks in advance 🙂

  • 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-01T11:44:08+00:00Added an answer on June 1, 2026 at 11:44 am

    There are a number of options that will return value or NULL:

    <?php
           $model = (isset($_GET['model']) ? $_GET['model'] : NULL);
            $mins = (isset($_GET['mins'])  ? $_GET['mins']  : NULL);    
           $texts = (isset($_GET['texts']) ? $_GET['texts'] : NULL); 
        $freegift = (isset($_GET['free-gift']) ? $_GET['free-gift'] : NULL);
         $network = (isset($_GET['network'])   ? $_GET['network']   : NULL);
            $plan = (isset($_GET['plan'])  ? $_GET['plan']  : NULL);
    ?>
    

    This will get the variables from their correponding $_GET element, only if there is one set.


    Alternative syntax (shorter):

    <?php
           $model = ($_GET['model'] ? $_GET['model'] : NULL);
            $mins = ($_GET['mins']  ? $_GET['mins']  : NULL);    
           $texts = ($_GET['texts'] ? $_GET['texts'] : NULL); 
        $freegift = ($_GET['free-gift'] ? $_GET['free-gift'] : NULL);
         $network = ($_GET['network']   ? $_GET['network']   : NULL);
            $plan = ($_GET['plan']  ? $_GET['plan']  : NULL);
    ?>
    

    Alternative (untested though):

    <?php
    $vars = array('model','mins','texts','free-gift','network','plan');
    
    foreach($vars as $value) {
        $$value = (isset($_GET[$value]) ? $_GET[$value] : NULL);
    }
    ?>
    

    EDIT:
    In order to set a WHERE clause based on it, I suggest:

    <?php
    $vars = array('model','mins','texts','free-gift','network','plan');
    
    foreach($vars as $value) {
        $$value = (isset($_GET[$value]) ? $_GET[$value] : NULL);
        unset $vars[$value];  //sweeping the NULL ones
    }
    $where_clause = $vars[0]; //the only remaining value after previous cleanup
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to search two item (name=string and location=json). this search is (one input
I have a form like this: <form action=search.php class='search' method='GET'> <input type=text/submit class=home_search_area value=Search
I want to search through a html file and then get the url to
I want to search a series of files based on the files name. Here
I want to search a php file to find all calls to a functions
I want to focus main search bar input after pressing s. I have: $(body).keypress(function(event)
I'm currently using ajax and jquery to update search results with a form that
I want to use a multiple autocomplete in my form using jQuery, PHP, and
We want to search a file to find all instances of bar that are
I want to search a user from LDAP and after getting the user I

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.