Solarpitch Posted March 27, 2007 Share Posted March 27, 2007 Hey guys, I am looking for a form to execute on what ever page the user preforms the action. I have a template that contains the below snippet. The below snippet will be called in every page . . ie index.php, about.php . . . When the user clicks submit the action will be the URL that the user is currently at so if the user is on "index.php" the code will put action as index.php echo '<form name="form1" method="post" action="index.php">'; I thought it was something like below but doesnt seem to work... echo '<form name="form1" method="post" action="./">'; Cheers, Gerard Link to comment https://forums.phpfreaks.com/topic/44522-telling-a-forms-action-method-the-current-page-the-user-is-on/ Share on other sites More sharing options...
per1os Posted March 27, 2007 Share Posted March 27, 2007 echo '<form name="form1" method="post" action="'.$_SERVER['PHP_SELF'].'">'; That should do what you want. Link to comment https://forums.phpfreaks.com/topic/44522-telling-a-forms-action-method-the-current-page-the-user-is-on/#findComment-216217 Share on other sites More sharing options...
Solarpitch Posted March 27, 2007 Author Share Posted March 27, 2007 Thank you Link to comment https://forums.phpfreaks.com/topic/44522-telling-a-forms-action-method-the-current-page-the-user-is-on/#findComment-216221 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.