Posted By

Scooter on 12/13/08


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

xuanyan


isPostBack()


 / Published in: PHP
 

URL: http://reusablecode.blogspot.com/2008/12/ispostback.html

  1. <?php
  2. /*
  3.   Copyright (c) 2008, reusablecode.blogspot.com; some rights reserved.
  4.  
  5.   This work is licensed under the Creative Commons Attribution License. To view
  6.   a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or
  7.   send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California
  8.   94305, USA.
  9.   */
  10.  
  11. // Determine whether the page was requested via GET or POST.
  12. function isPostBack()
  13. {
  14. return ($_SERVER['REQUEST_METHOD'] == 'POST');
  15. }
  16. ?>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: PoNs on December 13, 2008

Sometimes I wonder if people are really serious about the submitting people like this one...

I mean: What the hell? This ain't something about "for beginners", it is just crap.

if($_POST) and you're done...

Posted By: Scooter on December 20, 2008

You can use that shortcut if you want. Some consider checking the request method to be more proper.

If the quality of my submissions here is in question, I refer you to my other snippets.

I take note that you have never contributed any snippets, which brings into question the value of your comment.

Posted By: PoNs on December 30, 2008

The fact that you're a user of $SERVER['REQUESTMETHOD'] brings the value of any of your snippets into question.

You need to login to post a comment.