my goal is to select a record in my database with select/option tag so two columns can be pulled and echoed into input tags so they can be updated and then save back to the databse.
so far I have the select/option tag successfully pulling a record of my choice but it’s just sitting there doing nothing lol. I would like to echo the value of this select tag to my input tags in my form. I do ok in PHP but I think this is more a javascript function; which I;m not really good at. Or is there a way to pull it off while using just PHP and maybe having two submit button? one that would be clicked after the select tag has been selected and then another button to update the chages made in the form with the two input tag back to my database?
By the sound of it this is a job for AJAX - once you’ve selected a record from your select/option tag, you want to fire off a request to the server to return the data from that record and use it to populate the rest of your input form.
You could do it as a two-part form - the first form would just display the select/option list and have a “next” button, and the next button would send the selection to your PHP code which would select the record, and draw the remainder of the form with the data in it. You’d probably need a ‘back’ button as well to return to the selection.
Either would do the job, I would think the AJAX option would be the preferred method now. Plenty of tutorials on AJAX around if you’re not clear on any of it.
I been reading about AJAX and failed to see the point of using AJAX over regular POST? if I give my submit button for the first form where the select tag reside a name like let’s say “open” and then check to see if that button has been submitted and then get the $_POST value from the select box and echo it in my input tags, doesn’t that do the exact same?