MyBB Community Forums

Full Version: php help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
what in the world does the isset do?

thanks
Checks to see if a variable is set

EDIT:

from the php.net website

$var = '';

// This will evaluate to TRUE so the text will be printed.
if (isset($var)) {
   echo "This var is set so I will print.";
}
hmm alright thanks
You're welcome.
It's better for buttons
If you had a form

<?php

echo "<form action='{$_SERVER['PHP_SELF']}' method='post'>
Name: <input type='text' name='name' />
<input type='submit' name='submit' value='Submit' /> //notice "name='submit'"
</form>";

if (isset($_POST['submit'])) { //checks to see if submit button is clicked
echo "Hello {$_POST['name']}";
}

?>