|
Posted by Jerry Stuckle on 05/16/07 16:16
Phil Latio wrote:
> Quite a while back I used Java Swing (for Uni project) which allowed the
> developer to a create form and on the "Submit" button I recall adding
> something called an ActionListener. I was thinking of trying to do the
> something similar in PHP but a bit puzzled on how I would achieve it.
>
> My thoughts are to have a class for a Textbox, class for a SubmitButton and
> a class called ActionListener which is invoked (is that the correct term??)
> when the SubmitButton is pressed. Each instance of the ActionListener class
> will have a seperate set of instructions.
>
> Does anyone know of any tutorials online that discuss something like above?
> I've looked at a couple of Frameworks and QCodo does something along these
> lines.
>
> Cheers
>
> Phil
>
>
Phil,
You don't do it the same way in PHP. Java is much more event-driven
than PHP; it's doing some things behind the scenes that PHP doesn't do
for you.
When the submit button is pressed, a form is submitted to the server.
This includes a request for the page identified in the action= parameter
of your <form> element.
Java will take this request and drive the appropriate listeners for you.
PHP won't. In PHP you get the input via either $_GET or $_POST
(depending on the method= parameter) and handle the request.
It's a little more work for you to do it - but less overhead on the
server (Java calls action listeners for every bean being used, whether
you've overridden it or not).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|