...

checking post submit first or not

durangod
11-23-2010, 07:27 PM
hi, just curious, does it matter in the process if i check post submit first or second to the post var

so if i have


if (!empty($_POST['userlevel'])) {

if ($_POST['Submit']) {



as apposed to



if ($_POST['Submit']) {


if (!empty($_POST['userlevel'])) {



does it really make any dif in security or functionality! as long as they get checked?

Keleth
11-23-2010, 08:35 PM
In terms of functionality, simply checking $_POST['Submit'] could return in an error (based on how you're doing it, could also fail automatically in IE in terms of checking, as IE6 for example doesn't carry the value of a submit button, just that its set... so you need to check if its set). Otherwise, why check if the value exists first then if its submitted? The logic is backwards, and can cause headaches down the road. Always take the most logical path, it is programming after all.

durangod
11-23-2010, 09:00 PM
ok thanks so


if (isset($_POST['Submit']))


it is, and it comes first... thanks so much..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum