dnzone Posted March 14, 2006 Share Posted March 14, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/ Share on other sites More sharing options...
keeB Posted March 14, 2006 Share Posted March 14, 2006 Can you give the code listed on those lines? :DWould make it a lot easier to troubleshoot. Quote Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17271 Share on other sites More sharing options...
dnzone Posted March 14, 2006 Author Share Posted March 14, 2006 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 /> Quote Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17275 Share on other sites More sharing options...
txmedic03 Posted March 14, 2006 Share Posted March 14, 2006 Just post the code. Quote Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17280 Share on other sites More sharing options...
dnzone Posted March 14, 2006 Author Share Posted March 14, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17281 Share on other sites More sharing options...
redarrow Posted March 14, 2006 Share Posted March 14, 2006 echo "Current pgnodes is ",$pgnodes;Line 24 code is like thisif ( $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;}?>orif 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. Quote Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17284 Share on other sites More sharing options...
dnzone Posted March 14, 2006 Author Share Posted March 14, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17288 Share on other sites More sharing options...
redarrow Posted March 14, 2006 Share Posted March 14, 2006 [!--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 thisecho "Current pgnodes is ",$pgnodes;Line 24 code is like thisif ( $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 Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17295 Share on other sites More sharing options...
dnzone Posted March 14, 2006 Author Share Posted March 14, 2006 [!--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 thisecho "Current pgnodes is ",$pgnodes;Line 24 code is like thisif ( $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 Quote Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17296 Share on other sites More sharing options...
redarrow Posted March 14, 2006 Share Posted March 14, 2006 Post all pages for the problam for all to see ok that way we see everythink ok Quote Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17298 Share on other sites More sharing options...
dnzone Posted March 14, 2006 Author Share Posted March 14, 2006 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... Quote Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17302 Share on other sites More sharing options...
wildteen88 Posted March 14, 2006 Share Posted March 14, 2006 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 Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17310 Share on other sites More sharing options...
dnzone Posted March 14, 2006 Author Share Posted March 14, 2006 [!--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 Quote Link to comment https://forums.phpfreaks.com/topic/4905-passing-variable-from-one-page-to-another/#findComment-17608 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.