I created a modal window, and was able to send an ID value to a hidden input field that opens up in the modal window. I need to transfer the value of that ID so that I can use it in a mysql query, so I can grab more info from the database...

So here is the modal window that pops up:

<div class="modal hide" id="myModal">
    <div class="modal-header">
    	<button type="button" class="close"data dismiss="modal">x</button>
    </div>
    <div class="modal-body">
    	<p>One fine body!</p>
    	<input type="hidden" name="d_id" value="123" id="d_id"/>
    </div>
    <div class="modal-footer">
    	<a href="#" class="btn btn-primary">Save changes</a>
    </div>
</div>

So I want to add this php to the code:

$member_query = mysql_query("SELECT name, job FROM members WHERE (member_id='$d_id')");
while($row = mysql_fetch_array($member_query)){
	$member_name = $row["name"];
	$member_job = $row["job"];
}

I was thinking to use some sort of javascript when the modal window loads like "onload getelementbyid"... so basically I need to somehow transfer the hidden input value (123), into a php variable $d_id. Is there an elegant way to do that?

    juniper747;11009185 wrote:

    Is there an elegant way to do that?

    Would using jQuery to send an AJAX request qualify as 'elegant' ?

      Write a Reply...