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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:37:32+00:00 2026-06-12T16:37:32+00:00

Basically I got a PHP file that returns an array of different results (the

  • 0

Basically I got a PHP file that returns an array of different results (the PHP Sends the array and is received fine). Now I want that the JQuery autocomplete only search by the field “Name” and not by the other ones and that it only display the field “Name” when is suggesting results. but once is selected I want it to put in the page all the array of results.

Currently it is displaying everything that is pulling all array in the suggested search and only putting in the HTML the ‘name’.

I think what i have to do is catch the variables that are in JQ and then search just the name

Can anyone help me plz? thx u

PHP (WORKS)

                foreach ($this->get_charities() as $r){

                         $return = array (  'Name' => $r['Name'],
                                            'Contact' => $r['Contact'],
                                            'Postcode' => $r['Postcode'],
                                            'Phone' => $r['Phone'],
                                            'Fax' => $r['Fax'],
                                            'Website' => $r['Website'],                             
                                            'Email' => $r['Email'],
                                        );
                }

        return json_encode($return);    

JS

  <script>
        $(function() {
            function log( message ) {
                $( "<div>" ).text( message ).prependTo( "#log" );
                $( "#log" ).scrollTop( 0 );
            }

            $( "#birds" ).autocomplete({
                source: "search.php",
                minLength: 2,
                select: function( event, ui ) {
                    log( ui.item ?
                        "Selected: " + ui.item.value + " aka " + ui.item.id :
                        "Nothing selected, input was " + this.value );
                }
            });
        });
        </script>
  • 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-12T16:37:34+00:00Added an answer on June 12, 2026 at 4:37 pm

    You need to set array in php as below

    $return = array (  
        'value'=> $r['Name'],
        'label'=> $r['Name'],
        'Contact' => $r['Contact'],
        'Postcode' => $r['Postcode'],
        'Phone' => $r['Phone'],
        'Fax' => $r['Fax'],
        'Website' => $r['Website'],                             
        'Email' => $r['Email'],
    );
    

    Now, auto complete only search on Name values and also you can get your custom values into select function

    $( "#birds" ).autocomplete({
        source: "search.php",
        minLength: 2,
        select: function( event, ui ) {
                alert(ui.item.Phone);   <-- here you can get all your custom values.
            alert(ui.item.Contact); <-- here you can get all your custom values.
    
            log( ui.item ?
                "Selected: " + ui.item.value + " aka " + ui.item.id :
                "Nothing selected, input was " + this.value );
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got file index.php that includes index.php file in admin folder <?php require 'admin/index.php';
Basically i got this for loop and i want the number inputed (eg. 123)
Basically I just got some results back for an assignment and my results were
I've got a conversion utility that basically copies values from one table to another.
I've got a socket server running (it's something that's basically like a chat server).
Could someone point me in the right direction here? Basically, I've got this jQuery
I've basically got an XML file full of product information for use in an
I am using the comet long-polling technique with apache, php, jquery. I've got a
Basically, what I'm trying to do is search through a rather large PHP file,
I am just getting into OOP PHP but have got a little stuck. Basically

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.