Jquery or javascript for search - php

I have been looking for a script or API that i could use. To be able to search through data from mysql..
I have managed to create a dialog box and load all the data from mysql into it..
what i wont to be able to do have a text box that when u type in there username it searches the data straight away for them and being able to do this without refreshing or close the dialog box...
Anyone who has any idea on how to do this or ahs done it and has code or anything the help is greatly apprenticed and sosry for the lack in knowledge about this kinda stuff i only know the very basic

AutoComplete plugin is your choice

Related

Can't post data to self because of design

i have a website that uses a number of containers (div's). In this scenario, we have three boxes down the left side and one bigger box on the right of these boxes. The bigger box on the right is the only thing that changes when a link is pressed, this is done with Javascript.
SO i have the index which is the main layout of the website and i also have the "pages" of the site, so when a link is pressed the main box (on the right) loads the new data.
On one of my pages i want to collect data and then run it through a PHP script that is in the head of the file, but when i click the button i realise it refreshes the whole page and it doesn't run the script on the page with the form.
Anyone had a problem like this, or know of something i could do to work around it?
I'm not really sure what code would be useful for helping me but if you need something just ask.
Thanks for the help
Since you are loading all your content via JS already, you could just POST the form data via AJAX to a PHP script to process, then read the output and either provide an error message or remove the form from the page and show your success message.
How to approach your AJAX call is dependant on what you've used as a basis for the rest of your JS.
Personally I like to use the JQuery library, as it makes AJAX calls (and much more) very simple.
How about you make the page design able to do it. Have the backend be able to spit out the state of the page when it posted.
Or use Ajax to post the data back and set the new state like you do already.

Editing information from a MYSQL database from website frontend.

I wonder is someone can help, I'm building a website, which is driven from a database. It will consist of user submitted information.
Currently all the information is pulled from a record in the database and is being output via a PHP echo, what i would like too do is add a feature that would allow me to edit the information if incorrect from the websites front end.
I have seen many websites have some form of edit icon next to information in there databases, when clicking this icon the echoed text changes from text to a text field and you are able to update the field being echoed from the database.
Im a designer so have limited knowledge of how functionality for this kinda feature might work.
please could anyone let me know how something like this might be achieved.
many thanks.
You would need to build some kind of javascript functionality to allow the in-place editing of those data bits. One possible solution is a jQuery plugin like jEditable.
Then you need to build a server-side script in something like PHP or ruby where it would take the submitted information and update the database.
well the process is the same for the front-end and back-end. it depends whether you want you build a password protected editable forms or just editable for everyone.
One way you can do this is
echo your information into text inputs
give them a css class that removes the border and makes it transparent
make it readonly(so someone couldnt tab into it and change it)
add a javascript onclick event that changes the class to a normal
text box that is not readonly
add a javascript onchange event that uses ajax to save the new
information into the database when they are done typing, or press enter
after the ajax is done turn the text box back to the first css class
EDIT also add a onblur event that changes it back as well
you could even change the cursor for the text input to a pointer instead of the default (text) cursor so that is looks like you can click on it.
.
now html5 has contenteditable attribute which you can set for elements
simple example:
www.hongkiat.com/blog/html5-editable-content/
simpler demo:
https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_global_contenteditable

dynamic sql query using jquery + php

Just wondering if anyone can point me in the directuon of some tutorial/s that
Delve into sql queries/insertions/deletions (is that a word?) using jquery and/or php.
What I was specifically wanting to do was have a button that added an entry to a table
And then the button would change or dissappear or become greyed out.
Any links that might set me on the right track would be awesome!
Thank you in advance!
http://agiletoolkit.org/intro/addons
Scroll down for a CRUD implementation using jQuery UI dialog on top of Agile Toolkit
You should use something like achieved in jQuery UI dialog modal-form.
In the other end, you just sanitize input and make modifications.
It would be awesome, if you give more exact description of what you want achieve.

AJAX - how to make autocomplete/autosuggestion and show results outside form, in table

im trying to make a simple page with search engine. i read, that if i want to implement autocomplete/autosuggest with form, i have to use ajax. thats ok for me. there are a lot solutions on the intenret, but unfortunetly all of them is the same script :/ and thats fine for me :) but i want to go further. i want to show autosuggest results in table for example below search form. the data is stored in a simple array (eventualy, source mysql) i know that kind of script isnt easy to write, so i ask you to give me a hint or something. trivial solution is use php, but this needs submit button.
help, im stuck :)
You have to follow steps given below
1] Apply onkeyup on the textfield and called ajax request
2] findings = select * from artists where name like "params[]%"
where, params[] is the content of the textfield
findings is ur variable which should pass to the view as response.
3] Called a partial (view) in which you create a table depending on the response and replace a div on each ajax request.

web design question (php/ajax)

Hope this isn't a waste of your time. I'm working on a project, and it occured to me that there's a chunk of code out there, that should allow me to see how others have implemented this.
I've got a project where I'm going to have a page, with a sel box. the user will select an item from the selList, and based on the item selected, a separate section of the page (areaB) will change in terms of the content/tbls being displayed.
i then want to allow the user to go through a series of subpages in areaB, where the user goes through a submit/cancel/confirm process, where the stuff in areaB changes, with the rest of the page remaining the same...
i'm trying to figure out the best approach to implement the on both client/server side.
i could just have an ugly "if block" where i have abunch of logic, and i completely regen the page each time the user selects an action..
i could have an approach that might involve divs/frames, where i then just regen the targeted frame/div area.. is this even possible??
i could have some form of ajaxy process, which would only alter the targeted section(s) of the page...
so.. i'm trying to talk to anyone who has ideas on how to do this, or more ideally, if you know of a good code (client/server) side example of this... that i can examine. i'd really appreciate it!!
i've got a more detailed overview but didn't know if it would be cool to post it here...
thanks..
tom
If i've understood good this can be done in axaj. This is my idea you will have a where you load the current page with a form. After the submit button is pushed the values from form will be subtmited to an procesor let call it formprocesor.php. In formprocesor.php you will have a case that will check the step where you are in your submited for and will return the corect values to ajax proccessor in the main page. After values are recived, the ajax proccessor will display them in the result
Here is a little example: http://24ways.org/2005/easy-ajax-with-prototype there are more on a search on google with "ajax prototype tutorial"
Good luck!

Categories