The snippet of the PHP script below works for the most part... except for the fact that $rows[from_location_1] and $rows['to_location_1'] are not displaying all of the data.
The data consist of building code (letters) followed by a space then floor number/room number. example: NAC 1/200A. The script is displaying only the building code (NAC)
Note: the statement: echo "$rows[from_location_1]"; show all of the data.
I'm totally stumped after trying everything I can think of and read...
Any ideas as to what's causing it not to display all of the data and a possible get around will be greatly appreciated...
Thanks Chris
echo '<html>';
echo '<head><title> </title>';
echo '</head>';
echo '<body>';
echo '<form method=post action=xxx>';
echo '<table border=5>';
$rows= mysql_fetch_array($result);
echo '<tr><th>CIT Number</th><td>';
echo "<input type=text disabled value=" . $rows['citnum'] . "></td></tr>";
echo '<tr><th>Serial Number</th><td>';
echo "<input type=text disabled value=" . $rows['sernum'] . "></td></tr>";
echo '<tr><th>Move Date</th><td>';
echo "<input type=text value=" . $rows['move_date_1'] . "></td></tr>";
echo '<tr><th>From</th><td>';
echo "<input type=text value=" . $rows[from_location_1] . "></td></tr>";
echo '<tr><th>To</th><td>开发者_StackOverflow';
echo "<input type=text value=" . $rows['to_location_1'] . "></td></tr>";
echo '<tr><th>Comment</th><td>';
echo "<input type=text value=" . $rows['comment_1'] . "></td></tr>";
echo '</td><td align="center">';
echo '</td></tr></table>';
echo '<input type=submit value="Click To update">';
echo '</form>';
echo '</body>';
echo '</html>';
mysql_close($dbconnect);
Your echo statements from the database do not have any quotes around the $rows from the database. Also you should escape values coming from the database
change lines like
echo "<input type=text value=" . $rows['comment_1'] . "></td></tr>";
to
echo "<input type=text value=\"" . htmlspecialchars($rows['comment_1']) . "\"></td></tr>";
精彩评论