title: passing a php array item into a javascript popup window to be edited and updated in mysql db
body: <p>I am creating a diabetes management system for a university project. One of the features of this system is for the patient to be able to send latest glucose readings and for the nurse to be able to login and comment on those readings.</p>
  
  <p>I have been able to code the patient feature, however I wish to add a comment button in the comments column, which when clicked, brings up a popup window or a textbox for the nurse to be able to comment on that specific record. If a comment has not already been entered, an empty box should come up, however if there has been a previously entered comment, it should be displayed in the box to be updated and sent back to the mysql database. I would like to ask if someone could give me a way to include this comment box and code for the existing value to be displayed in the box and if there is no existing comment, then a new comment can be entered and stored in the database.</p>
  
  <p>Below is my php code. </p>
  
  <pre class="lang-php prettyprint-override"><code> &lt;?php//run query
      $result = mysql_query($GetReadings);
  ?&gt;
  
  &lt;table&gt;
      &lt;tr&gt;
      &lt;th&gt;Date&lt;/th&gt;
      &lt;th&gt;Time&lt;/th&gt;
      &lt;th&gt;Glucose Level&lt;/th&gt;
      &lt;th&gt;SBP&lt;/th&gt;
      &lt;th&gt;DBP&lt;/th&gt;
      &lt;th&gt;Comments&lt;/th&gt;
  &lt;/tr&gt;
  
  &lt;?php
      //display results
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  ?&gt;
  
  &lt;tr&gt;
      &lt;td&gt;&lt;?php echo $row["Date"]; ?&gt; &lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row["Time"]; ?&gt; &lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row["GlucoseLevel"]; ?&gt; &lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row["SBP"]; ?&gt; &lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row["DBP"]; ?&gt; &lt;/td&gt;
      &lt;td&gt;&lt;?php echo $row["Comments"];
  &lt;?php
  //if statement to add comment link if user is a nurse
  if ($_SESSION['User_level'] == 2)
      {
       //code for comments
      }
   ?&gt; &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;?php
          //end of while loop
      }
  ?&gt;
  </code></pre>
  
  <p>Hope I haven't missed out any crucial information.</p>