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
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
Comment