Posted By

mondomondomxcom on 08/30/09


Tagged

get php post variable


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

maxvee8
umang_nine
xmartyxcorex


PHP Get Variable


 / Published in: PHP
 

This is just a simple function to get the variable without having to worry if its POST or GET, and even allows for a default value to be passed in case the variable was not found.

  1. function getVar($str, $default="") {
  2. return (isset($_POST[$str]) ? $_POST[$str] : (isset($_GET[$str]) ? $_GET[$str] : $default));
  3. }

Report this snippet  

You need to login to post a comment.