PHP Classes

submit to other page

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  How to Show Google Ma...  >  All threads  >  submit to other page  >  (Un) Subscribe thread alerts  
Subject:submit to other page
Summary:submit to same page with include other page gives wrong URL
Messages:2
Author:Flip
Date:2011-11-24 02:04:53
Update:2011-11-24 03:34:38
 

  1. submit to other page   Reply   Report abuse  
Picture of Flip Flip - 2011-11-24 02:04:54
I would like to submit the form to another file.

I saw two other users have already asked about this here:
phpclasses.org/discuss/package/1/th ...
and
phpclasses.org/discuss/package/1/th ...

The suggestion was to do the form building & processing in the same script.
And then when the form has been processed include the page wanted.

The problem with this is that the URL does not match the actual content.
For example addtask will normally display the form, then submit to itself and a list of tasks are shown (because this is what i want after the form has been submitted). Now the URL is still addtask and not as listtasks as i want it to be.

I don't understand why it is recommended to submit to the same page, does the form class break if spread out over 2 pages??

There are a lot of examples excluded but nearly all (but a special one) have action="", so there are no examples how to submit from one page to another. I wonder if the normal example is split over 2 pages, 1 for the form, 1 for processing, which code is required in each page.

I will attempt to figure this out myself, i think i can do it. Though i would like to suggest if the class is updated to include one example of submitting to another page.

  2. Re: submit to other page   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2011-11-24 03:34:38 - In reply to message 1 from Flip
There is not really a rule that says that the URL of a page needs to match the content of the page.

But if that is important to you, you can always set the form to use the METHOD GET instead of the default POST, so the form input values will appear in the URL of the submitted page, while the submission script is still the same as the presentation script.

The problem of that approach is that if the user submits very long values in the inputs, the submission URL may become very long and some Web servers and proxies may truncate the URL.