Jump to content

[SOLVED] Variables from another page


Beta1.0

Recommended Posts

Hi to all!!

 

I am working on something and was wondering if the following is possible... ( I have tried it and am getting a blank instead of the value required).

 

Do I have to declare the name variable in Page1... or is there a way to go around it?..

 

One solution could be sessions...but Is there another solution?

 

Page1.php

----------

<?php

 

function printName(){

  print(" $name ");  //notice the quotes

}

 

?>

 

Page2.php

-----------

<?php

  include 'Page1.php';

 

  $name = "bob";

  printName();

 

?>

 

Thanks to all.. :)

 

Link to comment
https://forums.phpfreaks.com/topic/75539-solved-variables-from-another-page/
Share on other sites

Archived

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

×
×
  • Create New...

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.