Jump to content


Photo

Passing variable from one page to another


  • Please log in to reply
12 replies to this topic

#1 dnzone

dnzone
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 14 March 2006 - 07:39 AM

My problem is like this: -

This is the address that I type "http://localhost/php....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.

Thanks for the help & support given by all.

#2 keeB

keeB
  • Staff Alumni
  • Advanced Member
  • 1,078 posts
  • LocationCalifornia

Posted 14 March 2006 - 07:54 AM

Can you give the code listed on those lines? :D

Would make it a lot easier to troubleshoot.

Come visit my site to see my latest projects
http://nick.stinemates.org/wordpress/


#3 dnzone

dnzone
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 14 March 2006 - 08:09 AM

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 />

Thanks for the help & support given by all.

#4 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 14 March 2006 - 08:25 AM

Just post the code.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#5 dnzone

dnzone
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 14 March 2006 - 08:31 AM

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

The code for the line have been posted please help thanks.
Thanks for the help & support given by all.

#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 14 March 2006 - 08:47 AM

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

<?
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 />
?>


I DONT UNDRSTAND YOUR PROBLAM PLEASE EXSPLAIN THANK YOU.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#7 dnzone

dnzone
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 14 March 2006 - 09:02 AM

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.
Thanks for the help & support given by all.

#8 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 14 March 2006 - 09:27 AM

[!--quoteo(post=354811:date=Mar 14 2006, 09:02 AM:name=dnzone)--][div class=\'quotetop\']QUOTE(dnzone @ Mar 14 2006, 09:02 AM) View Post[/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.
echo "Current pgnodes is ".$pgnodes;

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#9 dnzone

dnzone
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 14 March 2006 - 09:38 AM

[!--quoteo(post=354819:date=Mar 14 2006, 05:27 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Mar 14 2006, 05:27 PM) View Post[/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
echo "Current pgnodes is ",$pgnodes;

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

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

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) View Post[/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.
echo "Current pgnodes is ".$pgnodes;
[/quote]

pgnodes is set to 0
Thanks for the help & support given by all.

#10 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 14 March 2006 - 09:54 AM


Post all pages for the problam for all to see ok that way we see everythink ok
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#11 dnzone

dnzone
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 14 March 2006 - 10:21 AM

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...
Thanks for the help & support given by all.

#12 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 14 March 2006 - 10:39 AM

You might want to change any instances of $pgnodes; to $_GET['pgnodes']; 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].

#13 dnzone

dnzone
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 14 March 2006 - 11:55 PM

[!--quoteo(post=354835:date=Mar 14 2006, 06:39 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Mar 14 2006, 06:39 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
You might want to change any instances of $pgnodes; to $_GET['pgnodes']; 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
Thanks for the help & support given by all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users