Soem logical issues to fix.
if ($sql) ...
else if (!$sql) ...
While the last part isn't wrong, it's also superflous. Either the first is true or the second is. So just else is enough. The main problem here is not checking what went wrong.
if ($sql) {
}
else {
echo/error_log( mysql_errno() . ': ' . mysql_error() );
}
The following else ifs will never be executed, since $sql can never be anything but true or false, which means that either the first or second if block is executed. Always.
And if you don't want to insert empty strings for name etc, check that BEFORE you actually insert anything.