How to display data from a database in a single text box

What I am trying to do is display data from a SQL database from one simple text field, but what the fetch array does is display multiple form fields as they loop through the fetch array.

How can I get only one input field and display all data in it?

You don't need my code as this is a generic php question, but here it is

<?php

$fetch_users_on_list = $db->query("SELECT * FROM table  WHERE blocked_by='$username'");
$fetch_users_on_list_rows = $db->num_rows($fetch_users_on_list);

while($fetch = mysql_fetch_array($fetch_users_on_list)) {

if($fetch_users_on_list_rows>0) {
   $default_selected = selected;
}


$update_form = "
      <div style='position:relative;left:250px;'>
        <text> <a href='' id='post_update_link' style=''> Post A Update </a>  </text> |
        <text> <a href='' id='upload_update_image' style=''> Upload A Image </a></text>
      </div>
      <div>

        <form action='' method='POST'>

        <div class='row'>
          <div class='col-md-2'><img  class='img-circle' width='100%'/></div>
          <div class='col-md-10'>
          <textarea name='post_message' class='form-control' id='feedbox' rows='1' placeholder='What Is Going On?'></textarea>


<select name='_privacy_selection' id='_privacy_selection'>
  <option value='everyone'>Everyone Can See This Post</option>
  <option value='staff_only'>Only Me and Clan Staff Can See This Post</option>
    <option name='certain_users' id='certain_users' value='certain_users' $default_selected>Certain Users</option>
  </select><br><br>
  <text id='block_field' style='display:none;'>dd</text>

            <input type='submit' name='post_message_submit' id='button' class='btn btn-default' value='Publish'><br>             
          </div>
        </div>
    </div>

<input type='text' name='privacy_data' id='privacy_data' value=''>


<text id='sometext' style='display:none;position:relative;left:250px;''>
  <b>Select A Image To Post As A Update</b><br>

          <textarea name='say_something_update' class='form-control' id='feedbox' rows='3' cols='8' style='width:30%;' placeholder='Say Something About This'></textarea><br>

      <input type='file' class='form-control' id='image_upload' style='width:50%;' name='image'><br>
      <input type='text' name='youtube_upload' id='youtube_upload' style='width:50%;' placeholder='Specify A YouTube Video URL'><br><br>
      <input type='submit' id='button_upload' class='btn btn-default'  name='process_upload' value='Publish' />

      </form>

</text>

<!-- 
    -this is the actual dialog, yes, it is included in your html body, it is just hidden
    -you can set the dialog title via the 'title' tag 
-->
<div id='basicModal' title='Update Is Empty' style='display:none;'>
    This post appears to be empty please write a update or attach a image first before attempting to post
</div>

 <div id='ttt' title='Duplicate Update' style='display:none;'>
  You have already posted this update please wait $time_set minutes before posting again<br>

</div>

  <div id='post_privacy_options' title='Control Who Can See This Post' style='display:none;'>

  <b>Who Can View This Post?</b><br>
  <input type='text' name='add_share_with_control' id='add_share_with_control' placeholder='Leave Blank If You Want Everyone To View This'><br>
  <small>Note: Specify Each User With A Coma </small>
  <br><br>

  <b>Block These People From Viewing This Post</b><br>

  <input type='text' name='block_share_with_control' id='block_share_with_control' placeholder='Leave Blank To Block No One'><br>
  <small>Note: Specify Each User With A Coma, You cannot block clan staff</small><br>
  <input type='submit' name='submit_values' id='submit_values' value='Done'><br>
  <text id='privacy_control_dialog_messages'> </text>

</div>

<!-- include the jquery library -->
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script>

<!-- include the jquery ui library -->
<script src='//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js'</script>
";
}
?>

      

+3


source to share





All Articles