You are here: Re: Action and Header « PHP Programming Language « IT news, forums, messages
Re: Action and Header

Posted by David Haynes on 02/02/06 05:13

sheldonlg@gmail.com wrote:
> I have used the action= statement to send the form to a new page which
> can get the posted variables.
>
> I have used the header("Location: foo.php) statement after testing on
> the submit with isset.
>
> What I want to know is if they can be combined. That is, test first
> with the isset, and if no errors go to the action call. Simply going
> with the header call doesn't seem to send the form variables.
>
> Am I missing something?
>
> Shelly
>
What I think you are asking is how to combine a POST method with a GET
method in order to chain the processing of a form across multiple php
files. That is: the action from the form (assuming the method is POST)
will post the form variables to the first php file (named in the
action). After you do the isset, you then want to pass control to the
second php file for further processing.

If so, there are a number of ways to accomplish this but the two
simplest are:
1. call the second php file using a GET method. That is: use the calling
form of second.php?var1=val1&var2=val2... As you can see, this will
expose the values for var1, var2, etc.
2. use the SESSION mechanism to pass the values to the second php file.
This involves writing the values to the session and then using the
header to call second.php. Second.php must use the session to read back
the values it is expecting.

Most other ways involve the use of temporary storage in a disk file,
database table or shared memory segment. These are less efficient and
more complex to set up.

-david-

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация