PHP single quote issues?

lyderslim

New member
I can't get my single-quote to output correctly from my PHP.

Here is the line from my PHP:
<input type='text'' value='".addslashes($row['business_name'])."' />"

And it puts out HTML that looks like this:
<input type='text' value='Tony\'s Pizza' />

Once the browser sees that quote, it stops and outputs:
"Tony\"
instead of "Tony's Pizza"

I've tried it without the addslashes and that doesn't do anything.
 
<input type='text'' value='".addslashes($row['business_name'... />"

should be

<input type='text'' value="<? echo addslashes($row['business_name']); ?>">

or

echo "<input type=\"text\" value=\"addslashes($row[business_name])\">";
 
Back
Top