Jump to content

Archived

This topic is now archived and is closed to further replies.

dnzone

Passing variable from one page to another

Recommended Posts

My problem is like this: -

This is the address that I type "http://localhost/phprog/node.php?pgnodes=0"

But the node.php page return this message
"PHP Notice: Undefined variable: pgnodes in c:\inetpub\wwwroot\phprog\node.php on line 9
PHP Notice: Undefined variable: pgnodes in c:\inetpub\wwwroot\phprog\node.php on line 25
PHP Notice: Undefined variable: pgnodes in c:\inetpub\wwwroot\phprog\node.php on line 46"

I don't understand why so can anybody help me... thanks.

Extra info:-
my OS Windows XP Service pack 2 & i am running the php page under Windows XP IIS web server.

Share this post


Link to post
Share on other sites
Can you give the code listed on those lines? :D

Would make it a lot easier to troubleshoot.

Share this post


Link to post
Share on other sites
Sorry just now i think you want the scirpt file so i ask for your email because i try to paste the code in but i can's submit it. I get a error page.

Line 9 code is like this
echo "Current pgnodes is ",$pgnodes;

Line 24 code is like this
if ( $pgnodes != 0 )

Line 46 code is like this
<input type="hidden" name="node" value="<?php echo $pgnodes;?>"><br />

Share this post


Link to post
Share on other sites
[!--quoteo(post=354803:date=Mar 14 2006, 04:25 PM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 14 2006, 04:25 PM) [snapback]354803[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Just post the code.
[/quote]

The code for the line have been posted please help thanks.

Share this post


Link to post
Share on other sites
echo "Current pgnodes is ",$pgnodes;

Line 24 code is like this
if ( $pgnodes != 0 )

Line 46 code is like this
<input type="hidden" name="node" value="<?php echo $pgnodes;?>"><br />


if pgnodes NOT = 0 echo statement

[code]
<?
if ($pgnodes !=0)
{
echo "Current pgnodes is ",$pgnodes;
}
?>
or

if pgnodes NOT = 0 echo form statement

<?
if ($pgnodes !=0)
<input type="hidden" name="node" value="<?php echo $pgnodes;?>"><br />
?>
[/code]


I DONT UNDRSTAND YOUR PROBLAM PLEASE EXSPLAIN THANK YOU.

Share this post


Link to post
Share on other sites
My problem is like this I have two php page. One is Forum.php and the other one is call node.php. Forum.php is the main page and when i click the link it will then call the node.php and at the same time pass the value click in the forum.php to the node.php's variable name $pgnodes. the problem now is that everytime i click the link from Forum.php to open the node.php, the node.php page will display the php error stated in my post above.

can you help me to solve the problem. thanks.

Share this post


Link to post
Share on other sites
[!--quoteo(post=354811:date=Mar 14 2006, 09:02 AM:name=dnzone)--][div class=\'quotetop\']QUOTE(dnzone @ Mar 14 2006, 09:02 AM) [snapback]354811[/snapback][/div][div class=\'quotemain\'][!--quotec--]
My problem is like this I have two php page. One is Forum.php and the other one is call node.php. Forum.php is the main page and when i click the link it will then call the node.php and at the same time pass the value click in the forum.php to the node.php's variable name $pgnodes. the problem now is that everytime i click the link from Forum.php to open the node.php, the node.php page will display the php error stated in my post above.

can you help me to solve the problem. thanks sorry got it.
[/quote]


Line 9 code is like this
echo "Current pgnodes is ",$pgnodes;

Line 24 code is like this
if ( $pgnodes != 0 )

Line 46 code is like this
<input type="hidden" name="node" value="<?php echo $pgnodes;?>"><br />
Show the code line of 9, 25 46 code from node.php ok.

line 9 should be ok know i hope.


What is pgnodes set to.
[code]
echo "Current pgnodes is ".$pgnodes;
[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=354819:date=Mar 14 2006, 05:27 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Mar 14 2006, 05:27 PM) [snapback]354819[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Show the code line of 9, 25 46 code from node.php ok.
[/quote]

Ok the code for line 9 is like this
[code]echo "Current pgnodes is ",$pgnodes;[/code]

the code for the line 25 is like this
[code]if ( $pgnodes != 0 )[/code]

the code for the line 46 is like this
[code]<input type="hidden" name="node" value="<?php echo $pgnodes;?>"><br />[/code]

Is there any problem with my code...



[!--quoteo(post=354819:date=Mar 14 2006, 05:27 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Mar 14 2006, 05:27 PM) [snapback]354819[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Line 9 code is like this
echo "Current pgnodes is ",$pgnodes;

Line 24 code is like this
if ( $pgnodes != 0 )

Line 46 code is like this
<input type="hidden" name="node" value="<?php echo $pgnodes;?>"><br />
Show the code line of 9, 25 46 code from node.php ok.

line 9 should be ok know i hope.
What is pgnodes set to.
[code]
echo "Current pgnodes is ".$pgnodes;
[/code]
[/quote]

pgnodes is set to 0

Share this post


Link to post
Share on other sites

Post all pages for the problam for all to see ok that way we see everythink ok

Share this post


Link to post
Share on other sites
when i paste the php code and then i try to submit the post i get a forbiden page why?
how do i post the entire script? pls help...

Share this post


Link to post
Share on other sites
You might want to change any instances of [b]$pgnodes;[/b] to [b]$_GET['pgnodes'];[/b] as you're using pgnodes; to get the variable value form the url which is incorrect as you dont have register_globals turned on. Instead you have it turned off which it should!

When you have register_globals turned off you have to use the superglobal arrays found [a href=\"http://uk.php.net/manual/en/language.variables.predefined.php\" target=\"_blank\"]here[/a].

Share this post


Link to post
Share on other sites
[!--quoteo(post=354835:date=Mar 14 2006, 06:39 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Mar 14 2006, 06:39 PM) [snapback]354835[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You might want to change any instances of [b]$pgnodes;[/b] to [b]$_GET['pgnodes'];[/b] as you're using pgnodes; to get the variable value form the url which is incorrect as you dont have register_globals turned on. Instead you have it turned off which it should!

When you have register_globals turned off you have to use the superglobal arrays found [a href=\"http://uk.php.net/manual/en/language.variables.predefined.php\" target=\"_blank\"]here[/a].
[/quote]


Thanks for the help guys. as it turn out i just need to use the $_GET['pgnodes']. Special Thanks to wildteen88

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.