Page 1 of 1

reading a variable with #

Posted: Thu Jul 29, 2004 6:43 pm
by pelegk2
i have page that recives avalue :

Code: Select all

<?php
1.php?file=123#asw1

?>
when i try to read this file variable i recive :

Code: Select all

$_REQUEST&#1111;'file'] == '123#'

 instead of :
$_REQUEST&#1111;'file'] == '123#asw1'
why is that?
thnaks in advance
peleg

Posted: Thu Jul 29, 2004 6:54 pm
by feyd
stuff after the # in a url is called a hash, it's used by the browser to change the focus to a named anchor inside the requested page. The server doesn't need to know it, and often doesn't.

Posted: Thu Jul 29, 2004 8:34 pm
by Illusionist
try to [php_man]urlencode()[/php_man] the url if you can

feyd i know

Posted: Fri Jul 30, 2004 3:38 am
by pelegk2
feyd i know that the # in an anchor tag butii talk about server side not client!!!!
why should it interest the server that u have an anchor?
it shouldnt!!!!

Posted: Fri Jul 30, 2004 3:46 am
by feyd
someone woke up cranky.. :roll: :?

Re: feyd i know

Posted: Fri Jul 30, 2004 7:52 am
by d3ad1ysp0rk
pelegk2 wrote:feyd i know that the # in an anchor tag butii talk about server side not client!!!!
why should it interest the server that u have an anchor?
it shouldnt!!!!
yes, it should. Whenever the server sees # in a URL, it's assuming the url looks like:
page.php#name
where name is the <a name> you'd like to start viewing the page at.

Sure, it'd be nice if the server ignored # signs that came after the =, but it doesnt, the same way it doesnt ignore & signs if you'd like to make them part of a variable (page.php?x=3sja&fdk&y=783rbdf won't read correctly, it'd most likely set a variable called fdk with no value, and then x=3sja..

Posted: Sun Aug 01, 2004 4:05 am
by pelegk2
so why it dosent do problem when i have :
file=dsfadsf=123
and gives me :
dsfadsf=123
and not just

dsfadsf

Posted: Sun Aug 01, 2004 9:52 am
by d3ad1ysp0rk
because there is no & in there, so i'd expect it to read the whole thing.