jchan
jchan

Reputation: 47

cannot display value correctly in HTML

I've 2 fields with same data type varchar(200) in mysql but when I input the same value (3" x 3 table) in HTML (the input type is text and textarea) and no problem found in mysql, but when I select the data and display in HTML form, only the textarea can display the full description (3" x 3 table) and the value in input type (text) is 3 without " x 3 table, so i have no idea on this but the value can display when I echo $row['desc1'] not sure why this cannot be displayed in html

$r12=$row['desc1'];
<td><input type="text" id="r1-2" name="r1-2" maxlength="200" style="width: 99%;" value="<?php echo $r12; ?>" /></td>

(php version is 5.3.8, mysql is 5.5.16).

Upvotes: 0

Views: 390

Answers (1)

ainasma
ainasma

Reputation: 89

Use htmlentities around $row['desc1'] as echo htmlentities($row['desc1']).

Upvotes: 1

Related Questions