0

How do you a class id into an input field?

<input type="text" name="loc" value="<p id='test'>bb</p>" />

The example above doesn't work properly. Also, how do I put a PHP echo command in it.

4

1 回答 1

1

Use htmlentities()

<input type="text" name="loc" value="<?php echo htmlentities("<p id='test'>bb</p>"); ?>" />

The output will look like this:

<input type="text" name="loc" value="&lt;p id='test'&gt;bb&lt;/p&gt;" />
于 2012-11-18T18:25:29.513 回答