soma56 Posted June 28, 2010 Share Posted June 28, 2010 I know how to redirect users using a simple form as a means of running a php script: <form action="mynewpage.php" method="post"> Name: <input type="text" name="name" value="" /> <br /> <input type="submit" name="submit" value="Name" /> </form> However, what if I wanted to include everything on the same page? I know that the form action should be as follows: <form action="" method="post"> Would I do a php include for the functions? If so, what's the best way (or any way for that matter) to call them when the user clicks the submit button? Link to comment https://forums.phpfreaks.com/topic/206121-how-do-you-call-functions-on-an-html-submit-within-same-page/ Share on other sites More sharing options...
Pikachu2000 Posted June 28, 2010 Share Posted June 28, 2010 <?php if(isset($_POST['submit'] { // Do this stuff if the form has been submitted . . . can be functions, includes(), etc. } else { // DO this other stuff if it hasn't been submitted . . . } ?> <form action="" method="POST"> . . . form stuff here . . . </form> Link to comment https://forums.phpfreaks.com/topic/206121-how-do-you-call-functions-on-an-html-submit-within-same-page/#findComment-1078477 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.