Floydian
05-28-2008, 04:23 PM
I've found that one of the biggest problems with making forms that people have when things aren't working the way they intended, is that they don't know what's being sent from one script to another.
function _display($type = 'request') {
echo '<div align="left">';
if ($type == 'request') {
echo "<pre>". print_r($GLOBALS['_REQUEST'], 1). "</pre>";
} elseif ($type == 'all') {
echo "<pre>". print_r($GLOBALS, 1). "</pre>";
} elseif ($type == 'session') {
echo "<pre>". print_r($GLOBALS['_SESSION'], 1). "</pre>";
}
echo '</div>';
}
_display(); is a function I use a lot when things aren't working for me. It shows me exactly what is being sent in the form.
I can't stress enough how helpful it is to actually SEEEEEEEEEEEE what is being passed.
Once you see what is being passed, you'll most likely find that debugging your script becomes quite a bit easier.
This function has other uses as well. _display('all') shows you every variable you have set. very handy.....
_display('session') shows you everything set in your $_SESSION array.
Note that _display() shows you the REQUEST array which is a compilation of POST, GET, and COOKIE arrays.
Have fun with it!
function _display($type = 'request') {
echo '<div align="left">';
if ($type == 'request') {
echo "<pre>". print_r($GLOBALS['_REQUEST'], 1). "</pre>";
} elseif ($type == 'all') {
echo "<pre>". print_r($GLOBALS, 1). "</pre>";
} elseif ($type == 'session') {
echo "<pre>". print_r($GLOBALS['_SESSION'], 1). "</pre>";
}
echo '</div>';
}
_display(); is a function I use a lot when things aren't working for me. It shows me exactly what is being sent in the form.
I can't stress enough how helpful it is to actually SEEEEEEEEEEEE what is being passed.
Once you see what is being passed, you'll most likely find that debugging your script becomes quite a bit easier.
This function has other uses as well. _display('all') shows you every variable you have set. very handy.....
_display('session') shows you everything set in your $_SESSION array.
Note that _display() shows you the REQUEST array which is a compilation of POST, GET, and COOKIE arrays.
Have fun with it!