php form action php self
Leaving the action value blank will cause the form to post back to itself.
How about leaving it empty, what is wrong with that?
<form name="form1" id="mainForm" method="post" enctype="multipart/form-data" action="">
</form>
Also, you can omit the action attribute and it will work as expected.
You can leave action blank or use this code:
<form name="form1" id="mainForm" method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['REQUEST_URI'];?>">
</form>
You can use an echo shortcut also instead of typing out "echo blah;" as shown below:
<form method="POST" action="<?=($_SERVER['PHP_SELF'])?>">