Make the form submit via a post and then you can split the logic in the code so that a GET request renders the form and the POST request deals with the data submitted.
--
David Reynolds
david@reynoldsfamily.org.uk
On 17 Jun 2012, at 12:23, Chris Green
cl@isbd.net wrote:
> Every time I try and do some web application programming that involves
> forms (i.e. getting data from a user) it ends up being far more
> complicated than I expect (and more complicated than it should be I
> feel).
>
>
> Anywhere else that one programs something to get some data from a user
> it's fairly direct and simple:-
>
> Output something to ask a question
> Wait for user to enter response
> Get return with the response
>
> OK, it's a bit more complex/messier when using a GUI because there isn't
> necessarily a simple single thread but it still comes down to the
> program waiting for an event and, when the event happens, it gets handed
> some data.
>
>
> However when web programming it's nothing like this, one can't simply
> ask a question and get the answer. Say one has a PHP script running
> server side, it creates a form which is then displayed when the client
> requests it and the client fills in the form. The trouble is that
> there's no direct way for the PHP script that created the form to get
> the result - at least there isn't in any of the environment/frameworks
> that I've used.
>
> What happens is that there is *another* script which gets run (server
> side) when the client submits the form duly filled in. This other
> script has no direct connection with the script that created the form,
> no common environment, nothing.
>
> It's thus very difficult to write simple form driven applications as one
> can't simply display a form and get the data from the form in 'one
> place' as it were.
>
> Am I missing something obvious here?
>
> --
> Chris Green
>
> _______________________________________________
> main@lists.alug.org.uk
>
http://www.alug.org.uk/
>
http://lists.alug.org.uk/mailman/listinfo/main
> Unsubscribe? See message headers or the web site above!