Problem:- I need to pass text from one page to another using hidden input like this:-
(page1) <textarea name=message>...form...post...etc,
(page2)<?php echo $message;
echo "<input type=hidden value=$message>"; ?>
(page3) <?php echo $message; ?>
This works fine until I use an apostrophe ' the mesage is displayed fine in page2 but page3 only displays the part of the textarea before the apostrophe '.
I have tried addslashes()/stripslashes() but this makes no difference
Help appreciated
Thanks
psoting hidden string
Moderator: General Moderators
probably because the HTML-source as seen by the browser look like
<input type=hidden value='it's all over now'>
The parser takes value='it'
write <input type="hidden" value="it's all over now">
and value will be "it's all over now"
but the problem starts all over again if $message contains "
addslashes is not the proper function to escape characters in an input-field
use urlencode() and urldecode() instead
<input type=hidden value='it's all over now'>
The parser takes value='it'
write <input type="hidden" value="it's all over now">
and value will be "it's all over now"
but the problem starts all over again if $message contains "
addslashes is not the proper function to escape characters in an input-field
use urlencode() and urldecode() instead
Gets it
Hi Volka,
I'm quite new to this and my lack of code knowledge causes me problems
but it's great when things work out, this was very basic but gave me much hair pulling.
urlencode()/decode() does the business a treat!! so thanks v much for your help.
As I get more experienced I will make a point of trying to answer other peoples questions, I know how much it can help.
Thanks again.
I'm quite new to this and my lack of code knowledge causes me problems
but it's great when things work out, this was very basic but gave me much hair pulling.
urlencode()/decode() does the business a treat!! so thanks v much for your help.
As I get more experienced I will make a point of trying to answer other peoples questions, I know how much it can help.
Thanks again.