fvgb — 2011-08-22T17:26:47-04:00 — #1
Is it possible to have HTML in a button value to show as processed HTML? Like this the raw HTML tags are displayed on the button instead of 'two cubed'.
$value = "2<sup>3</sup>";
<input type = "button" name = "answerBTN" value="$value">
felgall — 2011-08-22T17:48:39-04:00 — #2
Use <button name="answerRTN">$value</button> instead.
fvgb — 2011-08-22T18:04:48-04:00 — #3
Thank you, but that gives me the same result (perhaps it has something to do with me using prepared statements.) Besides I would rather keep the 'input' buttons since the whole site is adapted to them.
felgall — 2011-08-23T05:21:51-04:00 — #4
The button tag is for applying HTML styling to the button content - that's the only reason why it exists - because using input type="button" only allows plain text.
You also need to make sure that the value you are trying to use is not being processed through htmlspecialchars or htmlentities as that will convert the HTML tags in your content to text.
Using prepared statements should have no effect whatever.
fvgb — 2011-08-23T15:33:38-04:00 — #5
I was converting the values to text. I removed that and have now also changed all buttons to the button tag. It works just fine.
Many thanks for your help!