tags:

views:

39

answers:

1

Is it possible to to have a PHP form without having a seperate file,

e.g. Normal Form

<form action="send.php" method="post">

But instead of calling send.php have the code held in send.php in the same file as the form?

+4  A: 

Sure, just supply the action attribute with an empty action

<form action="" method="post">

or with a $PHP_SELF call.

<form action="<?php echo $PHP_SELF;?>" method="post">  

Both will submit to the current page.

Anthony Forloney
you can also use <input type="hidden" name="from" value="submit_form"> and use case blocks to further specify conditions on what post actions to take when the php is reloaded
CheeseConQueso