Sorry I couldn't find a better topic for this topic.
I have a cart page and I am changing for two things... The code I am about to show you works but I want to combine them.
if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1)
The code above check if the cart is empty
if ($_SESSION['User']['AccessLvl'] == null) { *this code check if the user is logged in or not.*
My question
I have a form
and I want to show this form on the page only when the cart is not empty. If
is the cart is empty the form shouldn't show.
also if the user is already sign in, the form shouldn't
show.
echo ' <form name="login" action="login.php">
</form>';
I tired this
if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1) {
} else {
if ($_SESSION['User']['AccessLvl'] == null) {
echo ' <form name="login" action="login.php">
</form>';
} else {
}
}
Summary
SHOULD ONLY, if user is NOT logged in
The form should only show when they is something(item) in the cart and
if the user is NOT
logged it.
SHOULD NOT
If the user is logged in already, the form should not show because they is no point asking someone to log in twice.
Can someone help me please. Thanks