halm1985 Posted June 12, 2007 Share Posted June 12, 2007 How would the ACTION part of the form look like if i want to do the following : Upon SUBMIT 1- execute SQL query THEN 2- go to Home Page Link to comment https://forums.phpfreaks.com/topic/55242-form-actions/ Share on other sites More sharing options...
lighton Posted June 12, 2007 Share Posted June 12, 2007 action="page.php" page.php would be something like this if(isset($_POST['submitted'])) { //do some stuff run sql etc // as long as you dont print anything the the page if you must use output buffering $url = home page etc header("LOCATION: $url) } i dont know how much you know, so does this make sense? Link to comment https://forums.phpfreaks.com/topic/55242-form-actions/#findComment-273027 Share on other sites More sharing options...
halm1985 Posted June 12, 2007 Author Share Posted June 12, 2007 isn't it possible to put multiple actions in the "action" part Like <FORM ........................... action = "$sql , homepage.php" in other words : must it be only one action ? Link to comment https://forums.phpfreaks.com/topic/55242-form-actions/#findComment-273032 Share on other sites More sharing options...
Yesideez Posted June 12, 2007 Share Posted June 12, 2007 Not sure what you mean by your last question but here's what I use: if ($_POST['subaction']) { RUN QUERIES HERE header("Location: your URL here"); exit; } Then in your HTML have your submit button called "subaction" or whatever you want to call it but be sure to keep the name of the submit in the $_POST the same - after all, you're checking to see if the button has been clicked. Remember to use exit() after the header() to stop the code from continuing. Link to comment https://forums.phpfreaks.com/topic/55242-form-actions/#findComment-273046 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.