Page 1 of 1

Strange issues while running winPHP on IIS6.0

Posted: Thu Aug 14, 2008 3:18 am
by belcherman
I am getting blank pages when I add code like:

Code: Select all

 
if ($username = = "letmein") {
print ("Welcome back, friend!");
}
else {
print ("You're not a member of this site");
}
 

EXAMPLE: - Page that works:

Code: Select all

 
<html>
<head>
<title>A BASIC HTML FORM</title>
 
<?PHP
 
$username = $_POST['username'];
print ($username);
 
?>
</head>
<body>
 
<FORM NAME ="form1" METHOD ="POST" ACTION = "">
 
<INPUT TYPE = "TEXT" VALUE ="username" NAME = "username">
<INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Login">
 
</FORM>
</body>
</html>
 
 










PAGE: Now I add a if then block and blank page is what shows up:

Code: Select all

 
<html>
<head>
<title>A BASIC HTML FORM</title>
 
<?PHP
if (isset($_POST['Submit'])) {
$username = $_POST['username'];
 
if ($username = = "letmein") {
print ("Welcome back, friend!");
}
else {
print ("You're not a member of this site");
}
}
 
?>
 
</head>
<body>
 
<FORM NAME ="form1" METHOD ="POST" ACTION = "basicForm.php">
 
<INPUT TYPE = "TEXT" VALUE ="username" NAME = "username">
<INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Login">
 
</FORM>
</body>
</html>
 
Results - this is what the source of the page that is outputed:

Code: Select all

 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY>
<META content=QRJATYDIMO name=SKYPE_FRAMEID>
<META content=QRJATYDIMO name=SKYPE_FRAMEID></HTML>
 

Re: Strange issues while running winPHP on IIS6.0

Posted: Thu Aug 14, 2008 3:27 am
by filippo.toso
The row 2 contains a parse error. It should be:

Code: Select all

if ($username == "letmein") {
I suggest you to configure PHP to display all the errors during the development phase.

Re: Strange issues while running winPHP on IIS6.0

Posted: Thu Aug 14, 2008 1:51 pm
by belcherman
What is funny is that I am copying this right out of a php lession book. How can I configure PHP to show all errors? I will look for that in the meantime. I guess the error is = = as it shoudl be ==?

Re: Strange issues while running winPHP on IIS6.0

Posted: Thu Aug 14, 2008 3:23 pm
by nowaydown1
There is a directive called display_errors that can be set in your php.ini file. Check out the PHP manual page (http://us2.php.net/manual/en/errorfunc. ... lay-errors) for specifics on how to get it running. As filippo.toso said, you were probably getting a blank page because a parse error was happening, but you didn't have display errors on.