Simple Question about <form action="">

I’m trying to build a log-in page and here is my question:

When using form actionit has to reference the same page that it is written inside?

I have a register.inc.php page, which has the form the users put their userid, password, name and email into. So when I write the form action statement it will be:

I guess I don’t understand why it would reference the same form it is placed within. Can anyone explain?

Thanks for your help.

It needs to reference whatever page will validate the form.

I prefer to use the following when the action is the same page.:

<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post"> 

If the processing of the form will be done on a different page, you should have the form action attribute point to that other page instead. It all depends on where the processing script is for that particular form.

Thank you both for your answers, you helped clarify that for me and I understand it better. On to other confusing code!

Sponsor our Newsletter | Privacy Policy | Terms of Service