Saturday, December 13, 2008

isPostBack()

Today's function comes not from PHP, but ASP.NET. We're going to replicate the isPostBack() function from ASP.NET's Page object.


ASP

  1. function isPostBack()
  2.     if uCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" then
  3.         isPostBack = true
  4.     else
  5.         isPostBack = false
  6.     end if
  7. end function

PHP

  1. function isPostBack()
  2. {
  3.     return ($_SERVER['REQUEST_METHOD'] == 'POST');
  4. }

No comments: