$nameErr
=
$addrErr
=
$emailErr
=
$howManyErr
=
$favFruitErr
=
""
;
$name
=
$address
=
$email
=
$howMany
=
""
;
$favFruit
=
array
();
if
(
$_SERVER
[
"REQUEST_METHOD"
] ==
"POST"
) {
if
(
empty
(
$_POST
[
"name"
])) {
$nameErr
=
"Missing"
;
}
else
{
$name
=
$_POST
[
"name"
];
}
if
(
empty
(
$_POST
[
"address"
])) {
$addrErr
=
"Missing"
;
}
else
{
$address
=
$_POST
[
"address"
];
}
if
(
empty
(
$_POST
[
"email"
])) {
$emailErr
=
"Missing"
;
}
else
{
$email
=
$_POST
[
"email"
];
}
if
(!isset(
$_POST
[
"howMany"
])) {
$howManyErr
=
"You must select 1 option"
;
}
else
{
$howMany
=
$_POST
[
"howMany"
];
}
if
(
empty
(
$_POST
[
"favFruit"
])) {
$favFruitErr
=
"You must select 1 or more"
;
}
else
{
$favFruit
=
$_POST
[
"favFruit"
];
}
}
0 comments:
Post a Comment