I have a form that I pre-fill with my database data. It is working perfectly for all my input. I have a text (that I enter in my database using a textarea). But when I am using the following the text does show in the text area (if I change it to input it is working but I do not have several lines and column allowed with textarea)
<textarea
rows="4"
class="form-control"
name="roster_description"
id="roster_description"
placeholder =
<?php if ($description_roster){
echo '"'.$description_roster.'"';
} else {
echo "";
}?>>
</textarea>
any ideas?
Just tested it and it works:
<textarea
rows="4"
class="form-control"
name="roster_description"
id="roster_description"
placeholder = "<?php if ($description_roster) echo $description_roster;?>">
</textarea>
Ok no clue why but the following is working:
<textarea class="form-control" id="description_roster"
name="description_roster" rows="4"
placeholder=<?php
if ($description_roster){
echo '"'.$description_roster.'"';
} else {
echo "";
}
?>
></textarea>
Thanks to those who had a look
The issue was that your statement:
echo "";
doesn't produce quotation marks - it produces the empty string. What you want is to replace this with:
echo '""';
which will produce placeholder="">
instead of placeholder=>
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.