Jump to content

Getting a Blank White Screen...


zelig

Recommended Posts

Okay, I can't seem to figure out why the form isn't pulling up.

 

Here's what I'm trying to do.

 

Administrator clicks on Add New Item to Inventory, pulling up the shops that are available to add inventory to. (This part appears to be working, because it does list those shops available).

 

Then, the administrator will click on a shop name, opening up a form that will allow them to type in the name of the item they want to add. Instead, it goes to a blank screen, no errors even with error reporting on.

 

adminpanel.php is the main file that houses all these functions. If you're familiar with EZRPG, it's the same basic setup, just with these additions to the list.

 

Any help would be greatly appreciated! Thank you!!

 

function addinv() {
    $query = doquery("SELECT id,name FROM shop ORDER BY name", "shop");
    $page = "<b><u>Add Inventory</u></b><br />Click to add an item to a shop's inventory.<br /><br /><table width=\"50%\">\n";
    $count = 1;
    while ($row = mysql_fetch_array($query)) {
        if ($count == 1) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">".$row["id"]."</td><td style=\"background-color: #eeeeee;\"><a href=\"admin_panel.php?do=addshopinv:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 2; }
        else { $page .= "<tr><td width=\"8%\" style=\"background-color: #ffffff;\">".$row["id"]."</td><td style=\"background-color: #ffffff;\"><a href=\"admin_panel.php?do=addshopinv:".$row["id"]."\">".$row["name"]."</a></td></tr>\n"; $count = 1; }
    }
    if (mysql_num_rows($query) == 0) { $page .= "<tr><td width=\"8%\" style=\"background-color: #eeeeee;\">No items found.</td></tr>\n"; }
    $page .= "</table>";
    admindisplay($page, "Add Shop Inventory");
    
}

function addshopinv($name) {

   if (isset($_POST["submit"])) {
        
        extract($_POST);
        $errors = 0;
        $errorlist = "";
        if ($name == "") { $errors++; $errorlist .= "Name is required.<br />"; }
	else if ($errors == 0) { 
		$query1 = doquery("SELECT * FROM items WHERE name=$name");
		$item_id = mysql_fetch_array($query1);
		$query = doquery("INSERT INTO `sale` SET shop_id=".$row["id"].", item_id='$item_id',");
            admindisplay("Inventory Item Added.","Add New Inventory Item");
        } else {
            admindisplay("<b>Errors:</b><br /><div style=\"color:red;\">$errorlist</div><br />Please go back and try again.", "Add New Item to Shop");
        }        
   }

   $name = 
    
$page = <<<END
<b><u>Add New Inventory Item</u></b><br /><br />
<form action="admin_panel.php?do=addshopinv:$name" method="post">
<table width="90%">
<tr><td width="20%">Name:</td><td><input type="text" name="name" size="30" maxlength="255" value="" />*255 character max</td></tr>
</table>
<input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" />
</form>
END;
    
    $page = parsetemplate($page, $row);
    admindisplay($page, "Add New Inventory Item");
    
}

Link to comment
Share on other sites

I've added:

 

error_reporting(E_ALL);

ini_set('display_errors', 1);

 

Both at the beginning of the php file and at the beginning of each function, but I'm still getting a white blank screen. I don't know where else to put it, or what else to use to figure this out.

 

I checked for whitespace, and I didn't find any.

 

Any other ideas?

Link to comment
Share on other sites

Error_reporting should be set to E_ALL (or even better a -1) and display_errors should be set to ON in your master php.ini on your development system. Stop and start your web server to get any changes made to the master php.ini to take effect. Confirm that the settings actually got changed by using a phpinfo statement in a script in case the php.ini that you changed is not the same one that php is using. The Loaded Configuration File value in the output from a phpinfo() statement is the php.ini that php is using.

 

The reason for setting these settings in the master php.ini is because putting the settings into your script won't show fatal parse errors in your main file (fatal parse errors in included files would be shown) because your main script never runs when there is a parse error in it and the settings won't take effect. Also, by putting these settings in to the master php.ini on your development system, you don't need to remember to put them into your files for debugging purposes and you don't need to remember to remove them when you put your files onto a live server.

 

The post by stenbom concerning white-space at the start of your file causing a blank page is irrelevant. The only time that would cause a blank page is if your page was performing a header redirect. The white-space would prevent the redirect and if error_reporting/display_errors settings are off, you would not get any indication of why the redirect failed.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.