Displaying existing data in a text field - 2 issues

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jej1216
    New Member
    • Aug 2006
    • 40

    Displaying existing data in a text field - 2 issues

    I am writing a PHP page to open a row of data from a MySQL database so the user can edit the data. This page mimics the inital data entry page. Everything is working so far, with the following two issues.

    In both cases, the display is a text field.
    Problem 1) When the data has spaces ("Barton Fink") and I display it in a textbox, it only shows "Barton." Is there a way to wrap the data so spaces don't signal and end of the data?
    Problem 2) When the exisitng field is blank, the display shows part of code that follows the display value ('SIZE=32'). Is there a way to display a blank as a blank?

    My partial code:
    [code-php]
    ......
    <?php
    $db = mysql_connect(" localhost", "root", "yeahright" ); mysql_select_db ("mytest",$d b);
    $result = mysql_query("SE LECT * FROM incidents WHERE incident_id = '$_GET[id]'",$db);
    $ID = $_GET['id'];
    while ($myrow = mysql_fetch_arr ay($result))
    {

    $other=$myrow["oth_descr"];
    $pname= $myrow["person_nam e"];
    }
    mysql_close($db );
    ?>
    [/code]
    and then
    [code-php]
    <FORM NAME = "irform" METHOD="POST" ACTION="ir_post ed.php">
    <table border="0" cellpadding="0" width="100%">
    <tr>
    <?php echo "<td>Other:<br> <INPUT TYPE=TEXT NAME='oth_descr ' VALUE=".$other. " SIZE=32 MAXLENGTH=25></td>"; ?>
    ...............
    <?php echo "<td>Name:<br>< INPUT TYPE=TEXT NAME='person_na me' VALUE=".$pname. " SIZE=32 MAXLENGTH=25></td>"; ?>
    ...............
    </tr>
    <INPUT TYPE=SUBMIT VALUE="Submit Form" >

    <INPUT TYPE=RESET VALUE="Reset Form">
    </FORM>
    .........
    [/code]
    TIA,
    jej1216
  • epots9
    Recognized Expert Top Contributor
    • May 2007
    • 1352

    #2
    [PHP]
    <?php echo "<td>Other:<br> <INPUT TYPE=TEXT NAME='oth_descr ' VALUE='".$other ."' SIZE=32 MAXLENGTH=25></td>"; ?>
    ...............
    <?php echo "<td>Name:<br>< INPUT TYPE=TEXT NAME='person_na me' VALUE='".$pname ."' SIZE=32 MAXLENGTH=25></td>"; ?>
    [/PHP]

    that will fix it displaying size.

    also, is the name in one field or in 2 fields on the database?

    Comment

    • jej1216
      New Member
      • Aug 2006
      • 40

      #3
      Originally posted by epots9
      [PHP]
      <?php echo "<td>Other:<br> <INPUT TYPE=TEXT NAME='oth_descr ' VALUE='".$other ."' SIZE=32 MAXLENGTH=25></td>"; ?>
      ...............
      <?php echo "<td>Name:<br>< INPUT TYPE=TEXT NAME='person_na me' VALUE='".$pname ."' SIZE=32 MAXLENGTH=25></td>"; ?>
      [/PHP]

      that will fix it displaying size.

      also, is the name in one field or in 2 fields on the database?
      That took care of the blank field.

      The name is one field in the db.

      Thanks,

      jej1216

      Comment

      • jej1216
        New Member
        • Aug 2006
        • 40

        #4
        Originally posted by jej1216
        That took care of the blank field.

        The name is one field in the db.

        Thanks,

        jej1216
        That actually fixed both issues - once again, Thanks!

        jej1216

        Comment

        • jej1216
          New Member
          • Aug 2006
          • 40

          #5
          The last piece -- I am not able to display any text area data -- it displays as blank.
          [code-php]
          <?php echo "<textarea rows=11 cols=120 name=inc_descr value='".$incde scr."'></textarea>"; ?>
          [/code]
          The value might be "Patient stumbled on his shoelaces and fell to the floor. Staff were unable to get to the patient to break his fall."

          Using the code above, the text area is blank.

          Thanks,

          jej1216

          Comment

          • jej1216
            New Member
            • Aug 2006
            • 40

            #6
            I'm going to start a new post with this issue.

            Thanks,

            jej1216

            Comment

            Working...