So for the variables I need $_GET ... and $_POST for the form.
Is it correct to put something like this:
Code: Select all
$var = $_GET['var'];
$var = $_POST['var'];Note that I do filter the input to make sure nothing nasty comes through.
Moderator: General Moderators
Code: Select all
$var = $_GET['var'];
$var = $_POST['var'];Code: Select all
if(!empty($_POST))
$var = $_POST['var'];
else
$var = $_GET['var'];Code: Select all
if (!empty($_POST['var'])) {
$var = $_POST['var'];
} elseif (!empty($_GET['var'])) {
$var = $_GET['var'];
} else {
$var = 'default';
}