11-05-2009, 04:19 PM
:confused:I am writing php code to select data via a dropdown list from a mysql table of materials for a transaction log. I want to be able to insert a new material if it is not in the dropdown list. How can this be done without leaving the page, inserting a new record, returning to the page, refreshing the page to repopulate the dropdown?
Do I need to use js? or can this be done with php?
This seems like a situation which I would think many programmers have a need for.
11-05-2009, 05:36 PM
Example using jQuery (http://thesteveblog.blogspot.com/2009/03/jquery-login-without-refresh.html)
11-05-2009, 08:02 PM
I can understand the desire to "not leave" the current page. Your situation is exactly what Ajax techniques were developed for.
PHP script happens at the server and results in data that is sent to the client.
Ajax, not being a 'language' but a technique, is all about using JS on the client,after to reach back to the server for additional information. When the ajax object gets an answer back from the server, JS reads the response and uses it to update the page.