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

Re: how to pass a data-id to php 80 80

I found this jsFiddle that shows an example of data being passed to the bootstrap modal window, might be useful http://jsfiddle.net/Au9tc/605/

Re: how to pass a data-id to php 80 80

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.

Re: how to pass a data-id to php 80 80

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.

Re: how to pass a data-id to php 80 80

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

Re: how to pass a data-id to php 80 80

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

Re: how to pass a data-id to php 80 80

Oops, replied to the wrong thread. Apologies.

Re: how to pass a data-id to php 80 80

@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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.