html to php - dealing with quotes problem
Posted: Tue Jun 29, 2010 2:09 pm
The following works just fine. But I need to add something that has quotes in it.
echo "<p class='verticaltext'>" . $name_char . "</p>";
The problem is that the whole echo statement has to be in double quotes “ and anything inside of that that would normally be in double quotes in HTML has to be in single quotes. Well what about something in that that would be in single quotes?
In regular HTML I would do this:
<p class=”verticaltext” onmouseover=”this.style.color=’red’”>Some Text To Display</p>
The word red is in single quotes.
I need this:
echo "<p class='verticaltext' onmouseover='this.style.color=red'>Some Text To Display</p>"
but "red" has to be quoted.
When you use echo on it you put all of it in doubles and turn the doubles into singles. But what do you do with the singles? I tried using multiple single quotes and also tried just taking them out. Nothing worked. How is this done?
echo "<p class='verticaltext'>" . $name_char . "</p>";
The problem is that the whole echo statement has to be in double quotes “ and anything inside of that that would normally be in double quotes in HTML has to be in single quotes. Well what about something in that that would be in single quotes?
In regular HTML I would do this:
<p class=”verticaltext” onmouseover=”this.style.color=’red’”>Some Text To Display</p>
The word red is in single quotes.
I need this:
echo "<p class='verticaltext' onmouseover='this.style.color=red'>Some Text To Display</p>"
but "red" has to be quoted.
When you use echo on it you put all of it in doubles and turn the doubles into singles. But what do you do with the singles? I tried using multiple single quotes and also tried just taking them out. Nothing worked. How is this done?