Jump to content

PHP Error - Getting Generic IE Error Message


947740

Recommended Posts

Hey guys - I have php code that has an error, but I don't know what's wrong, as IE8 keeps spitting out a generic error message, even when I set PHP to display all errors.  Perhaps a quick glance from someone else would be sufficient. :)

 

<?php

define('ROOT', "../");

require_once(ROOT . "includes/config.php");

class CreateLinkPage extends Page {

public function run() {
	if( $this->is_post() ) {
	$vals = array();
	$vals[ 'link_name' ] = $this->post_val( 'link_name' );
	$vals[ 'color' ] = $this->post_val( 'color' );
	$vals[ 'parent_link' ] = $this->post_val( 'parent_link' );
	$vals[ 'article' ] = $this->post_val( 'article' );
	$vals[ 'url' ] = $this->post_val( 'url' );
	$vals[ 'admin' ] = $this->post_val( 'admin' );
		if( $vals[ 'url' ] != '' ) {
		$vals[ 'article' ] = '';
		}
	$insert_qry = $this->insert_query( 'links', $vals );
	$db = $this->get_db();
		if( $db->query( $insert_qry ) ) {
		$this->redirect( 'links/create.php', "Link added successfully." );
		}else{
		$this->log( $db->error );
		$this->redirect( 'links/create.php', "Unable to add link at this time." );
		}
	}
	else {
	$db = $this->get_db();
	// This is the HTML we will need
	// Get list of articles

	$articles = $db->query("SELECT ID,title FROM articles WHERE nolink = 0");
	$articlebox = "<select name='article'>" . PHP_EOL;
	$articlebox .= "<option value=''>None</option>" . PHP_EOL;
		while($row = $articles->fetch_object()) {
		$articlebox .= "<option value='{$row[ 'ID' ]}'>{$row[ 'title' ]}</option>" . PHP_EOL;
		}
	$articlebox .= "</select>" . PHP_EOL;

	// Get list of links

	$links = $db->query("SELECT ID,link_name FROM links WHERE parent_link = 0");
	$linkbox = "<select name='parent_link'>" . PHP_EOL;
	$linkbox .= "<option value='0'>None</option>" . PHP_EOL;
		while($row = $links->fetch_object()) {
		$linkbox .= "<option value='{$row[ 'ID' ]}'>{$row[ 'link_name' ]}</option>" . PHP_EOL;
		}
	$linkbox .= "</select>" . PHP_EOL;

	$html = "
	<div id='center'>
	<div id='floaty'>
	<form name='form' action='create.php' method='post'>
	Link name: <input type='text' name='link_name' />
	Color: <input type='text' name='color' value='#ffffff' />
	<br />
	Parent link: $linkbox

	Admin Only: <select name='admin'>
	<option value='0'>No</option>
	<option value='1'>Yes</option>
	</select>
	<br />
	URL: <input type='text' name='url' />
	Article: $articlebox
	<br />
	<input type='submit' name='submit' value='Create Link' />
	</form>
	</div>
	</div>
	";

	echo $html;
	}
}

$pg = new CreateLinkPage();

$pg->getHeader(CREATE_LINK_ID);
$pg->getLinks();
$pg->run();
$pg->getFooter();

?>

 

Thanks ahead of time.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.