问题
check these lines please
<textarea class="wideInput" cols="30" rows="10" value="<?php echo $row['foodDescription']; ?>" ></textarea>
<input value="<?php echo $row['foodDescription']; ?>" />
the input type has the default value, but the textarea doesn't , why please , what is the solution?
回答1:
There is no value attribute
<textarea class="wideInput" cols="30" rows="10" ><?php echo $row['foodDescription']; ?></textarea>
回答2:
You can add value in between <textarea> starting and ending tag.
<textarea class="wideInput" cols="30" rows="10"><?php echo $row['foodDescription']; ?></textarea>
回答3:
<textarea class="wideInput" cols="30" rows="10" value="<?php echo $row['foodDescription']; ?>" ></textarea>
should be changed to:
<textarea class="wideInput" cols="30" rows="10"><?php echo $row['foodDescription']; ?></textarea>
because textarea doesn't have value attribute
回答4:
Simply put the value in between the textarea tags:
<textarea class="wideInput" cols="30" rows="10">
<?php echo $row['foodDescription']; ?>
</textarea>
回答5:
A textarea isn't like an input, it can't be self-closed (<textarea/>), it is self closing tags that can have a value to default display. Just change your code to echo the foodDescription inside the <textarea></textarea> tags
回答6:
You have to put the default value between the tags so:
<textarea class="wideInput" cols="30" rows="10"><?php echo $row['foodDescription']; ?></textarea>
回答7:
It has to be in-between the tags.
<textarea class="wideInput" cols="30" rows="10"><?php echo $row['foodDescription']; ?></textarea>
Lol preaching to the choir
来源:https://stackoverflow.com/questions/15383397/textarea-cant-have-a-default-value