I checked the manual but I still don't get it.
http://us2.php.net/manual/en/language.variables.scope.php


I'm setting a variable $pics with a form by post method. It's on a "screen" that is included, then it needs to be applied to another "screen" that will take it's place when it's all re-processed.


template
  include header
  include SCREEN (picture or settings)
  include footer

Now, the template sets $pics to a default and then I can pull up the picture screen and setting $pics global makes it work but if I go to the settings screen to change $pic, it doesn't stick, even if I set it global there. I'm not sure if I need to set global once in the template or not there but in each screen I want to use it.




template: -------------------- global $pics; if (!isset($pics)){$pics = 8;}


picture screen: -------------------- global $pics; # works fine with the setting 8 from the template

settings screen:
--------------------
global $pics;
print $pics; #for debugging, always follows template setting
if (!isset($pics)){$pics = 5;}
  if ($_POST){
    if (isset ($_POST['thumbs'])){
      $pics = $_POST['thumbs'];
      print "settings have been changed";
    }
}

?>

<form name="mail" action="<?php SCREEN_DIR . "/settings.php" ?>" method="post">
<label for="thumbs">number of thumbnails per page: </label>
<input type="text" name="thumbs" id="thumbs" size="2"
value="<?php print $pics ?>">
<button type="submit">OK</button>
</form>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to