Reputation: 1049
I am stuck with modal window. My modal window is on same page which I put in <div>
, this modal window will popup when user click on a 'Reply Message' text.
while (($i < $num3b)&&($i < ($start+$perpage))) {
$tododetail_id=mysql_result($result3b,$i,"tododetail_id");
$comment=formatUrlsInText(mysql_result($result3b,$i,"comment"));
$staff_name=mysql_result($result3b,$i,"staff_name");
echo "<tr><td><span><font color='#5858FA'>" . $staff_name . nl2br($comment) . "</font>
<span style='float:right' id='create-user'>Reply Message</span>";
$i++;}
And Modal Window will appear using below code, i want to pass $staff_name
and $comment
so that it will appear in modal window. but i don't know how to call and pass those variables
$(function() {
var repmsg = $( "#repmsg" );
$( "#dialog-form" ).dialog({
autoOpen: false,
height: 280,
width: 660,
modal: true
});
$( '[id^="create-user"]')
.click(function() {
$( "#dialog-form" ).dialog( "open" );
});
});
Here my modal window code
<div id="dialog-form">
<p class="validateTips"><!--show php variable ($staff_name)--></p>
<form>
<fieldset>
<textarea class="text ui-widget-content ui-corner-all" name='repmsg' cols='100' rows='8' tabindex='1004'></textarea><br/>
<span id="quote" style="float:left">Requote</span>
<span style='float:right' id='button'>
<span id="add" class="button_form" style="cursor:pointer;">Add</span>
<span id="cancel" class="button_form" style="cursor:pointer;">Cancel</span>
</span>
</fieldset>
</form>
</div>
Hopefully you can understand my statement. Thank you.
Upvotes: 0
Views: 982
Reputation: 19895
In your loop you create several span with the same id. An id must be unique in a html page.
You must create different ids. This will also allow you to get the data with jquery.
Also think about putting your staff name in a separate div or span. This will ease accessing it.
Upvotes: 1
Reputation: 3778
In below part, just put the staffname variable:
<p class="validateTips"><?php echo $staff_name; ?></p>
This staffname will be shown when dialog opened
Upvotes: 0