0

I have a question on how to achieve something from a development standpoint in Laravel. I am looking for ways to use autoload to return data from a database by just supplying a few character entry. For example, if I need to search for the word 'Johnson' which is already stored in a table in the database, supplying the word: 'Joh' in the search bar should bring up Johnson and other names like Johnson. I am very new to PHP and laravel, does anyone have any suggestions?

3
  • You can read the docs try the code given and share tried code if any problem ? Commented Oct 12, 2017 at 3:49
  • 1
    Read this expertphp.in/article/… Commented Oct 12, 2017 at 4:28
  • Thanks I will look into implementing it this way. Commented Oct 12, 2017 at 5:02

1 Answer 1

1

You are going to have to use Ajax and php to do this.

Basically the logistics will be as such: a key is typed into an input which will load a javascript function that does a post to a php file. That php file will do a query for "Joh%". All records will come back matching Joh%. Print them out with php and it will be delivered back to the javascript function which called the php file in the first place. Now that javascript function will have to manage adding and subtracting entries from the dropdown on the input box you are typing in.

The question your asking is basically a lot of code and you should take it step by step. First start by getting a php query to work where you get records matching "Jon%", then continue on to another step.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.