On Friday 22 November 2002 07:26, [EMAIL PROTECTED] wrote:
> Hello,
>
> I have a newbie problem. I have an php page that has many layers of forms
> to it. Once the user is finished with filling out one form and sending it,
> another form appears. This is of course done using simple if-else or switch
> statements. The problem is, how do I initialize a function or any other
> type of process just ONCE for the entire page. I don't want the function or
> process to run everytime a new form is displayed. Keep in mind that I'm
> also using sessions for this. Here is a tiny stripped-down example, of my
> failed attempt, that might help you analyze my question:
>
> session_start();
>
> if(!isset($initialize)) {
>    $start_over = 1;
> }

> if ($start_over == 1) {
>    $temp_log = $logged_in;
>    session_unset();
>    $logged_in = $temp_log;
>    $initialize = 1;
>    session_register("logged_in", "initialize");
> }

> There is the code/pseudo-code combination of what I have so far. The only
> problem is that it is not processing the second if block -- if($start_over
> == 1) -- unless I actually set start_over=1 in the get string. How would I
> make sure that the page processes everything in that if block only ONCE
> after the page first loads? Also, if anyone knows a better way of
> displaying one form after another in on a single php page, I'm open to any
> ideas.

OK, the only reason why the 2nd  IF block is not executed is if $initialize is 
not empty (ie isset($initialize) is TRUE hence $start_over = 1 is never 
executed). So try:

 if(!isset($initialize)) {
    $start_over = 1; }
 else {
   var_dump($initialize); // to see what the **** it contains
 }


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
My BIOLOGICAL ALARM CLOCK just went off ... It has noiseless DOZE
FUNCTION and full kitchen!!
*/


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

Reply via email to