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

$_SERVER['argv'] doesn't have a value on first page load.

P: n/a
when i first load index.php with arguments ie: "index.php?page=x", the
$_SERVER['argv']value is null. I then get the session id appended to
each link. If i refresh the page, I get the $_SERVER['argv'] I want,
but if i click a link $_SERVER['argv'] returns the value I want and
the session id.
Any ideas as to how I can get the $_SERVER['argv'] to return the
arguments on first page load?

Thanks much,

Ryan
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
user wrote:
when i first load index.php with arguments ie: "index.php?page=x", the
$_SERVER['argv']value is null. I then get the session id appended to
each link. If i refresh the page, I get the $_SERVER['argv'] I want,
but if i click a link $_SERVER['argv'] returns the value I want and
the session id.
Any ideas as to how I can get the $_SERVER['argv'] to return the
arguments on first page load?


Have you tried $_GET["page"]? This should return "x" on the first page
load. It obviously won't return the session id. You can't get the
session id on the first load, that's when you start a session.
Jul 17 '05 #2

P: n/a
On Sun, 17 Oct 2004 01:11:30 GMT, Lüpher Cypher
<lu***********@verizon.net> wrote:
user wrote:
when i first load index.php with arguments ie: "index.php?page=x", the
$_SERVER['argv']value is null. I then get the session id appended to
each link. If i refresh the page, I get the $_SERVER['argv'] I want,
but if i click a link $_SERVER['argv'] returns the value I want and
the session id.
Any ideas as to how I can get the $_SERVER['argv'] to return the
arguments on first page load?


Have you tried $_GET["page"]? This should return "x" on the first page
load. It obviously won't return the session id. You can't get the
session id on the first load, that's when you start a session.


no freak'n way!
here I was going to try and write a function to parse it and
everything ;)

Thank's Lüpher
Jul 17 '05 #3

P: n/a
user wrote:
On Sun, 17 Oct 2004 01:11:30 GMT, Lüpher Cypher
<lu***********@verizon.net> wrote:

user wrote:
when i first load index.php with arguments ie: "index.php?page=x", the
$_SERVER['argv']value is null. I then get the session id appended to
each link. If i refresh the page, I get the $_SERVER['argv'] I want,
but if i click a link $_SERVER['argv'] returns the value I want and
the session id.
Any ideas as to how I can get the $_SERVER['argv'] to return the
arguments on first page load?


Have you tried $_GET["page"]? This should return "x" on the first page
load. It obviously won't return the session id. You can't get the
session id on the first load, that's when you start a session.

no freak'n way!
here I was going to try and write a function to parse it and
everything ;)


Why reinvent the wheel? :)

parse_str($_SERVER['QUERY_STRING'],$params);
echo $params["page"]; // outputs "x"

This will create an associative array in $params :)
Jul 17 '05 #4

P: n/a
On Sun, 17 Oct 2004 06:09:46 GMT, Lüpher Cypher
<lu***********@verizon.net> wrote:
user wrote:
On Sun, 17 Oct 2004 01:11:30 GMT, Lüpher Cypher
<lu***********@verizon.net> wrote:

user wrote:

when i first load index.php with arguments ie: "index.php?page=x", the
$_SERVER['argv']value is null. I then get the session id appended to
each link. If i refresh the page, I get the $_SERVER['argv'] I want,
but if i click a link $_SERVER['argv'] returns the value I want and
the session id.
Any ideas as to how I can get the $_SERVER['argv'] to return the
arguments on first page load?
Have you tried $_GET["page"]? This should return "x" on the first page
load. It obviously won't return the session id. You can't get the
session id on the first load, that's when you start a session.

no freak'n way!
here I was going to try and write a function to parse it and
everything ;)


Why reinvent the wheel? :)

parse_str($_SERVER['QUERY_STRING'],$params);
echo $params["page"]; // outputs "x"

This will create an associative array in $params :)

cool man. Thanks again...
the $_GET["page"] doesn't get a value on the first load either...

so confused...

http://www.internetdefender.net

I have index.php displaying, and starting the session, and I've
included a display.php that stores arrays of dynamic content. based on
page, it loads the content into a div.
It works... I just can't hotlink to say
http://internetdefender.net/index.php?page=safety

IF I refresh, it grabs the value, but not on first load...
I've tried setting the page from index, and display.php using:
<?php session_start();
$_SESSION['args'] = $_GET["page"];
?>

any suggestions?
btw, totally appreciate the help so far :)

/Ryan
Jul 17 '05 #5

P: n/a
user wrote:
On Sun, 17 Oct 2004 06:09:46 GMT, Lüpher Cypher
<lu***********@verizon.net> wrote:

user wrote:
On Sun, 17 Oct 2004 01:11:30 GMT, Lüpher Cypher
<lu***********@verizon.net> wrote:

user wrote:
>when i first load index.php with arguments ie: "index.php?page=x", the
>$_SERVER['argv']value is null. I then get the session id appended to
>each link. If i refresh the page, I get the $_SERVER['argv'] I want,
>but if i click a link $_SERVER['argv'] returns the value I want and
>the session id.
>Any ideas as to how I can get the $_SERVER['argv'] to return the
>arguments on first page load?
>

Have you tried $_GET["page"]? This should return "x" on the first page
load. It obviously won't return the session id. You can't get the
session id on the first load, that's when you start a session.
no freak'n way!
here I was going to try and write a function to parse it and
everything ;)


Why reinvent the wheel? :)

parse_str($_SERVER['QUERY_STRING'],$params);
echo $params["page"]; // outputs "x"

This will create an associative array in $params :)


cool man. Thanks again...
the $_GET["page"] doesn't get a value on the first load either...

so confused...

http://www.internetdefender.net

I have index.php displaying, and starting the session, and I've
included a display.php that stores arrays of dynamic content. based on
page, it loads the content into a div.
It works... I just can't hotlink to say
http://internetdefender.net/index.php?page=safety

IF I refresh, it grabs the value, but not on first load...
I've tried setting the page from index, and display.php using:
<?php session_start();
$_SESSION['args'] = $_GET["page"];
?>


Hmm.. Are you trying to set "page" in session? I'd do session_register()
first, then :) As for $_GET, I can't think of a reason why it's not
there - it has to be.. If I stumble on an error like this, when
something is wrong with a variable or value that I pass through whatever
global, I usually check up on it using
echo "<pre>".print_r($GLOBALS)."</pre>";
This will output everything that's been passed to the script :) (notice
the pre tag :), you can also use print_r(nl2br($GLOBALS))) :)
Jul 17 '05 #6

P: n/a
On Sun, 17 Oct 2004 16:09:19 GMT, Lüpher Cypher
<lu***********@verizon.net> wrote:

<snip>
Hmm.. Are you trying to set "page" in session? I'd do session_register()
first, then :) As for $_GET, I can't think of a reason why it's not
there - it has to be.. If I stumble on an error like this, when
something is wrong with a variable or value that I pass through whatever
global, I usually check up on it using
echo "<pre>".print_r($GLOBALS)."</pre>";
This will output everything that's been passed to the script :) (notice
the pre tag :), you can also use print_r(nl2br($GLOBALS))) :)


much appreciated :)
It works now. I registered the varaiable in index when I start the
session, then assigned it in display using $page = $_GET["page"];

Thank's :)
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.