PDA

Click to See Complete Forum and Search --> : Run a POST script


joefox
Dec 20th, 2006, 10:12 AM
How do i make it so that i dont trigger a POST action on a page.

For example, i have a home page, that has links on it to other web pages of mine, one will be "update part", that page has a POST script in it, and for some reason it runs everytime i go to that page from another page, and i dont want it to.

I wanted the user to be able to go to the "update part" page, then hit a button to update a part, and thats when it will run the POST script.

Any ideas?

kows
Dec 20th, 2006, 01:11 PM
make sure the user is posting a form to it.

<?php
//normal code stuff

if($_SERVER['REQUEST_METHOD'] == "POST"){
//anything in here will be executed upon posting to this script
}else{
//anything in here will only be executed if you are NOT posting to this script
}
?>