i need to pop a bootstrap modal but from inside will need to make queries from a PHP variable that will vary depending on where the pop originated from.

so i have this in my file :

<a href="#" class="btn btn-md btn-success"
    data-toggle="modal"
    data-target="#editUser"
    id="User"
    data-id="UserID123">
    update
</a>

How can I put the value UserID123 in a php variable once in the modal so I can use it for queries ... I've been looking around but haven't seen the solution ... some suggest AJAX but i could figure out to adapt it here

thanks

Recommended Answers

All 8 Replies

interesting ... but this variable stays outside the graps of php (server side) .. i need to capture it to do a mysql query to prefill a form.

You need to send the data to the PHP script one if two ways... Either by posting to the page (form post and send the value via an input element) or use AJAX to interact with the PHP script without having to post/reload the page.

SO i guess using AJAX to give a vlaue to $POST sounds like the solution... anywhere you can send me to to learn about how ajax will do that.. ? seem a bit lost. Everything posted out there since to specific

thank you both ... nothing like going from ground up .

Oops, replied to the wrong thread. Apologies.

@Marc_5, hi. Did you a ge solution in your problem? I have the same issue and I need to know how to do it.

commented: Try direct messaging the member too. +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.