Connecting Tech Pros Worldwide Forums | Help | Site Map

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

user
Guest
 
Posts: n/a
#1: Jul 17 '05
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

Lüpher Cypher
Guest
 
Posts: n/a
#2: Jul 17 '05

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


user wrote:[color=blue]
> 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?
>[/color]

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.
user
Guest
 
Posts: n/a
#3: Jul 17 '05

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


On Sun, 17 Oct 2004 01:11:30 GMT, Lüpher Cypher
<lupher.cypher@verizon.net> wrote:
[color=blue]
>user wrote:[color=green]
>> 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?
>>[/color]
>
>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.[/color]

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

Thank's Lüpher
Lüpher Cypher
Guest
 
Posts: n/a
#4: Jul 17 '05

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


user wrote:[color=blue]
> On Sun, 17 Oct 2004 01:11:30 GMT, Lüpher Cypher
> <lupher.cypher@verizon.net> wrote:
>
>[color=green]
>>user wrote:
>>[color=darkred]
>>>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?
>>>[/color]
>>
>>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.[/color]
>
>
> no freak'n way!
> here I was going to try and write a function to parse it and
> everything ;)[/color]

Why reinvent the wheel? :)

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

This will create an associative array in $params :)
user
Guest
 
Posts: n/a
#5: Jul 17 '05

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


On Sun, 17 Oct 2004 06:09:46 GMT, Lüpher Cypher
<lupher.cypher@verizon.net> wrote:
[color=blue]
>user wrote:[color=green]
>> On Sun, 17 Oct 2004 01:11:30 GMT, Lüpher Cypher
>> <lupher.cypher@verizon.net> wrote:
>>
>>[color=darkred]
>>>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.[/color]
>>
>>
>> no freak'n way!
>> here I was going to try and write a function to parse it and
>> everything ;)[/color]
>
>Why reinvent the wheel? :)
>
>parse_str($_SERVER['QUERY_STRING'],$params);
>echo $params["page"]; // outputs "x"
>
>This will create an associative array in $params :)[/color]


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
Lüpher Cypher
Guest
 
Posts: n/a
#6: Jul 17 '05

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


user wrote:[color=blue]
> On Sun, 17 Oct 2004 06:09:46 GMT, Lüpher Cypher
> <lupher.cypher@verizon.net> wrote:
>
>[color=green]
>>user wrote:
>>[color=darkred]
>>>On Sun, 17 Oct 2004 01:11:30 GMT, Lüpher Cypher
>>><lupher.cypher@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 ;)[/color]
>>
>>Why reinvent the wheel? :)
>>
>>parse_str($_SERVER['QUERY_STRING'],$params);
>>echo $params["page"]; // outputs "x"
>>
>>This will create an associative array in $params :)[/color]
>
>
>
> 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"];
> ?>[/color]

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))) :)
user
Guest
 
Posts: n/a
#7: Jul 17 '05

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


On Sun, 17 Oct 2004 16:09:19 GMT, Lüpher Cypher
<lupher.cypher@verizon.net> wrote:

<snip>[color=blue]
>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))) :)[/color]

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 :)
Closed Thread