how to check if a variable exists

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
HomerTheDragoon
Forum Newbie
Posts: 21
Joined: Sat Jul 08, 2006 2:10 am

how to check if a variable exists

Post by HomerTheDragoon »

how do I do this?

Also what happens if i assign a varrible $POST_['variable'] and there wasnt a varible sent.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Code: Select all

<?php
if (!isset($_POST['variable'])) {
    echo 'Not Set!';
} else {
    echo 'Set! Yay!!!';
}
?>
Post Reply