Simply, to send a form to itself, you can use a special variable called
$PHP_SELF. Here's an example of how to use it:

if ($somevalue) {
   header("Location: $PHP_SELF");
} else {
   execute some other code...
}

Here, if $somevalue holds true, it will call itself and reload the same
script/file. This code is not very useful at all, but it gets the point
across. If you wanted to pass GET variables to this, then you could
easily say:

header("Location: $PHP_SELF?var=value&var2=value2&var3=value3");

...and so on. You can also use this approach with Sessions if you wanted
to turn the values back over to the form page, assuming you had two
pages: one for the form, and one for form checking and entry into a
database. There are several ways to check forms, whether you want it on
one page or span it out to several pages. You just need to be creative
in what tools are avaiable to you. Here is an example of how you can
pass session values:

header("Location: some_file.php?<?=SID?>");

Here, whatever variables you've registered in session_register() will be
passed to the php page you specify, in this case some_file.php. Hope
this helps. Have fun, and happy coding.  :)


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

Reply via email to