PDA

View Full Version : variables containing an apostrophy in hidden input fields


Script Junkie
11-16-2005, 01:31 AM
I'm having a problem with apostrophy's . I need to be able to have them entered into my input fields, but if i enter an apostrophy, on the next page, when it is added to a hidden input field, the apostrophy causes it to only save the text up to the apostrophy and it "loses" the rest of the text. I tried changing the variable in the hidden field from '$example' to "param('example')" and still end up with the same problem.

changed from
print <<End;
<input type='hidden' name='last_name' value='$last_name'>
End
to
print "<input type='hidden' name='last_name' value='", param('last_name'), "'>";
that almost worked (if almost working is possible lol)

so lets say i entered "Mac'Grady" as the last name, it would save in the variable and go on to the next page. however on the next page, the source would look like this

<input type='hidden' name='last_name' value='Mac'Grady'>
so only "Mac" would be sent on to the next page as "$last_name"

so now after previewing my post (once again) i noticed somthing. i think i'll try
print <<End;
<input type='hidden' name='last_name' value="$last_name">
End

not sure quotes will help so any futher input would be appreciated

Script Junkie
11-16-2005, 02:22 AM
Yup, switching to quotes seems to have fixed my problem, thanks for the help LOL