By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,089 Members | 2,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,089 IT Pros & Developers. It's quick & easy.

if value contains & and i am using get method tp pass data to another form

P: n/a
hi

i am using get method to pass data from one form to another and my
value may contain & symbol. so when this is case the value after & sign
is truncated which is logically true.

so what should i do to solve this problem

and if value contain ? symbol then it will make any difference?????
i have not checked this but just it came in mind right now so i am
asking you.
is there any otehr characters which i should consider except & and ?
while using get methos to pass data from one form to another
thxs for your reply in advance

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
vishal wrote:
hi

i am using get method to pass data from one form to another and my
value may contain & symbol. so when this is case the value after & sign
is truncated which is logically true.

so what should i do to solve this problem

and if value contain ? symbol then it will make any difference?????
i have not checked this but just it came in mind right now so i am
asking you.
is there any otehr characters which i should consider except & and ?
while using get methos to pass data from one form to another
thxs for your reply in advance


Hi,

You should ALWAYS url-encode your values.
Look at this:

$name= "Zaphod Breeblebox";
$age = "how should I know?";
$favfood = "fish&fries";

Now if you want to send that as an url in name/value pairs, do this:

$url = "http://www.yoursite.com/somescript.php?";
$url .= "name=".urlencode($name);
$url .= "&age=".urlencode($age);
$url .= "&favfood=".urlencode($favfood);

now $url contains a valid encoded url with name/value pairs.

header ("Location: $url");
Hope that helps.

Regards,
Erwin Moller
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.