RE: [PHP] Are variables persistent?

2004-02-16 Thread Jay Blanchard
[snip]
When I refresh a script using a form, it goes through  resets all my 
custom Constants but presumably all my variables should still hold their

values from the last run, right? THere are no functions involved.

What would cause a variable or even a $POST[] value to be erased?
[/snip]

Refreshing the script causes the variable arrays to be repopulated with
empty or blank variables unless a session was used to hold the
variables. Refreshing is essentially calling the script without passing
any variables.

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



Re: [PHP] Are variables persistent?

2004-02-16 Thread Paul Furman
Jay Blanchard wrote:
What would cause a variable or even a $POST[] value to be erased?
[/snip]
Refreshing the script causes the variable arrays to be repopulated with
empty or blank variables unless a session was used to hold the
variables. Refreshing is essentially calling the script without passing
any variables.


Ah ha!
whew
So...

$_REQUEST is the only way to go without getting into sessions? Hidden or 
other form methods will not work with out sessions, I guess. Damn, I 
wish I knew that four hours ago!

: - )

I thought I didn't want to clutter the URL this time so I'd try that. Ha!

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


Re: [PHP] Are variables persistent?

2004-02-16 Thread Paul Furman
Paul Furman wrote:
So...

$_REQUEST is the only way to go without getting into sessions? 


OK I see, it either goes in the url or a cookie.

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


RE: [PHP] Are variables persistent?

2004-02-16 Thread Jay Blanchard
[snip]
$_REQUEST is the only way to go without getting into sessions? 
[/snip]

Nope, $_REQUEST (as its name implies) contains variables that are part
of the request process. If you refresh the form the $_REQUEST array will
essentially be empty for those vraibles that would be passed from form
to process.

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



Re: [PHP] Are variables persistent?

2004-02-16 Thread Paul Furman
Jay Blanchard wrote:

[snip]
$_REQUEST is the only way to go without getting into sessions? 
[/snip]

Nope, $_REQUEST (as its name implies) contains variables that are part
of the request process. If you refresh the form the $_REQUEST array will
essentially be empty for those vraibles that would be passed from form
to process.


OK I'm confused. I want to set a variable with a form. How do I do that? 
I guess I need to put it in the url? I did a mail form  that worked by 
putting stuff in the $POST and when it refreshed to the same mail page, 
I grabbed the stuff back out of that (at least that's what I thought I 
was doing.

Maybe I just put the new value in the url with the action property of 
the form and forget about the $POST part. I guess I don't know how that 
worked for the mail script.

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


Re: [PHP] Are variables persistent?

2004-02-16 Thread Paul Furman
Paul Furman wrote:
OK I'm confused. I want to set a variable with a form. How do I do that? 
I guess I need to put it in the url? I did a mail form  that worked by 
putting stuff in the $POST and when it refreshed to the same mail page, 
I grabbed the stuff back out of that (at least that's what I thought I 
was doing.

Maybe I just put the new value in the url with the action property of 
the form and forget about the $POST part. I guess I don't know how that 
worked for the mail script.


I had the script below working to extract the results of $POST[thumbs]. 
Assuming I can get that going again, would I then redirect with header() 
putting the new value in the url? The problem is I want it to stick to 
the pictures page (not this settings page) every time I go to that page 
so I'd have to tack it on to any page on my site and keep checking for 
it everywhere to keep it. I'm guessing this is not a sensible approach. 
Every place I construct a url, I'd have to remember to add this.

broken now but I can fix it again if it'll work

h1Change Settings/h1
center
div class=textbox
?php
  if ($POST){
if (isset ($POST['thumbs'])){
$pics = $POST['thumbs'];
print settings-out:.$pics. ; #work(ed) after posting
print settings have been changed;
### redirect here to the picture page 
### with $pics value in the url 
### header() exit() 
}
} ?
  form name=mail action=?php SCREEN_DIR . /settings.php ?
method=post
  label for=thumbsnumber of thumbnails per page: /label
  input type=text name=thumbs id=thumbs size=2
 value=?php print $pics ?
  button type=submitOK/button
  /form
/div
/center
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Are variables persistent?

2004-02-16 Thread Matt Matijevich
snip
 I'm guessing this is not a sensible approach. 
Every place I construct a url, I'd have to remember to add this.
/snip

Have you looked into sessions and/or cookies?

I think you want to use $_POST not $POST

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



Re: [PHP] Are variables persistent?

2004-02-16 Thread Paul Furman
Matt Matijevich wrote:
snip
 I'm guessing this is not a sensible approach. 
Every place I construct a url, I'd have to remember to add this.
/snip

Have you looked into sessions and/or cookies?


I'm taking a class  we are probably not going there for a while. It 
looks involved.



I think you want to use $_POST not $POST
Yep, thanks. I guess I can add the $_REQUEST in the template file so 
maybe it's not too compicated.

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


Re: [PHP] Are variables persistent?

2004-02-16 Thread Paul Furman
Ugh, I think I'm done for the day. header() requires output buffering 
which would span several files and sounds like another mess.

Paul Furman wrote:

Matt Matijevich wrote:

snip
 I'm guessing this is not a sensible approach. Every place I construct 
a url, I'd have to remember to add this.
/snip

Have you looked into sessions and/or cookies?


I'm taking a class  we are probably not going there for a while. It 
looks involved.



I think you want to use $_POST not $POST


Yep, thanks. I guess I can add the $_REQUEST in the template file so 
maybe it's not too compicated.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php