Jump to content

Form Actions ?!!


halm1985

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.