0

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.

2
  • @Michael I appreciate that you are trying to help by editing, but one-letter edits to the title aren't really all that useful. A whole lot of people would prefer that you only make suggested edits that address all the issues in the post, or don't suggest an edit at all if a single typo is the only problem. Commented Mar 27, 2014 at 0:29
  • @TheGuywithTheHat What are "suggested edits"? Usually I edit bad formatted code to well formatted code cause I hate to see bad code styling, makes it hard to read for everyone! Of course I also improve content of questions and answers. However, yesterday I was searching for an answer, but I could not find it because of a typo in the title (found it later when I made the typo myself). So I decided to fix some typos in titles. It's fast reputation and the main reason I did this is that it helps search engines to find question/answers. That's a good point even though it's not a mayor improvement. Commented Mar 27, 2014 at 8:28

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

In below part, just put the staffname variable:

<p class="validateTips"><?php echo $staff_name; ?></p>

This staffname will be shown when dialog opened

1 Comment

my data for $staff_name is gained from looping process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.