3. $submit is the variable for the submit button, it's telling that it the same page is loaded and posting something, the if ($submit) statement is used to perform that action. $Picture is the name of the file.
As bradgrafelman noted, such usage relies on register_globals being set to on in php.ini, and this leaves PHP scripts susceptible to variable poisoning. In this case, use $POST['submit'] and $FILES['Picture'] instead. This is how I might write it:
if (isset($_POST['submit'], $_FILES['Picture'])) {
if ($_FILES['Picture']['error'] == UPLOAD_ERR_OK) {
// Proceed with the uploaded file.
} else {
// Handle file upload error.
}
}
7. Wait, so you can't use a variable more than once with a loop? I thought it could be used multiple times? I'll I'm trying to do is select a field and a certain row from a MySQL database, and using it as a variable.
Of course you can use a variable more than once in a loop. However, when the loop ends, the value of that variable would be what it was on the last iteration of the loop. Since you are assigning to $username on each iteration, all the iterations except the last one would have no net effect (other than to slow down your script).