how to use a link to open a modal and set php get variable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to use a link to open a modal and set php get variable

i have a table that lists users(fetched from db), each row has an Edit button which holds the id of the user when clicked it sends the id to the page and brings data back from db based on the id and fills out a form with the data to be edited How do i send it to a modal form when edit is clicked and bring back data from db. https://code.sololearn.com/w1Uv1C84RQf6/?ref=app

16th Jun 2019, 7:11 AM
Leoulg
Leoulg - avatar
1 Answer
+ 2
You need to use AJAX for that purpose. See: https://www.w3schools.com/js/js_ajax_intro.asp Basically, what you need to do is to make asynchronous request to your server, which will return (preferably, in JSON format) the data from database, which you could flll in the JavaScript generated form using "value" attribute of input tag. Hope that makes it clear.
30th Jun 2019, 12:33 AM
Freezemage
Freezemage - avatar