Re: Form action

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When I first started out with PHP, I asked the same myself the same questions as you just did. But over the years I have concluded:

Method (1) centralizes all your form submission processes for addition, deletion, updating purposes, which means when you want to start debugging, you would end up having to debug A (one) particular file only. But makes your debugging process just a little bit tiresome, in the case where your form is a little bit complicated.

Method (2) decentralizes all your form submission processes, but in a way you'd simplify your coding practice as you segregate your forms from your submission processes, which simplifies debugging, and you would not need to go through all your line of codes, as in method (1)

There are pros and cons to these two methods, I would prefer to use method (1), and as soon as the form gets submitted, I'd end up utilizing either Javascript or the header function to redirect the page. So that when users won't be able to click on the "back" button.

Well, that's just my honest opinion, other may have other ideas.


Ng Hwee Hwee wrote:

Hi all,

i'm designing a lot of forms and would like to know the standard practice. which of the following will be advisable?

1) form action is $PHP_SELF
   i.e. <form name="form01" action="<?=$PHP_SELF;?>" method="post">
   i.e the script to check if the values submitted is valid and the scripts to
        insert the data into the database are all in the same php file with the form.
2) form action is another verification php file
   i.e. <form name="form01" action="verify_form.php" method="post">
   i.e the script to check if the values submitted is valid and the scripts to
        insert the data into the database are in a different php file with the form.

which of them is best?? i read before that the second option is preferred because if users click "back" on their browser, they will not resubmit the form again etc.. does anyone has a suggestion for me?

thank you so much!

regards,
hwee




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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux