I’m using the basic framework of the a php login form provided here: http://www.html-form-guide.com/php-form/php-login-form.html
It works great when I am on a Mac or PC. When login from an iPhone, the $_SESSION array is empty, so the identify of the logged in user is lost, and the system wasn’t to redirect to login.php.
How can I prevent the $_SESSION array from getting wiped out?
Probably your iPhone browser does not have cookies enabled. Due to security reasons, the PHP sessions default to cookie usage, however there is a second way using a GET parameter as well, often called SID. Make use of that get parameter and you should be fine for cookie-less browsers.