PDA

View Full Version : Insert string with quote into input field


cbranje
08-24-2006, 03:56 AM
Hi

So lets say I have an form with a text input.
Like this . . .

<input type=\"text\" name=\"title\" value=\"$title\" size=\"15\"/>



what if $title = "This is some "cool" stuff";

with quotes around cool, if I put that string in as is, it messes up my form. Anyone know how to get around this

rmedek
08-24-2006, 04:14 AM
Either have backslashes inserted into the variable (like you're using now) or use single quotes for the input:


<input type='text' name='title' value='This is some "cool" stuff' size='15' />

Wylie
08-24-2006, 04:19 AM
$title = "This is some \"cool\" stuff";

cbranje
08-24-2006, 01:03 PM
Either have backslashes inserted into the variable (like you're using now) or use single quotes for the input:


<input type='text' name='title' value='This is some "cool" stuff' size='15' />



What if $title = "This is some 'cool' stuff" . ..same problem

Carmen

cbranje
08-24-2006, 01:04 PM
$title = "This is some \"cool\" stuff";

This doesn't work . .

Carmen