Location: PHPKode > projects > Prsaar Social Networking Platform > PrsaarColour-0.7.alpha.6.3/pr-admin/option-link-edit.php
<?php
	require_once('admin.php');
	//_________________________________________________________
	$Display->Title = 'Options';
	$Display->Subtitle = 'Manage links';
	//__________________________________________________________
	require('./admin-display-header.php');
	
	if(isset($_GET['action']))
		$Action = $_GET['action'];
	if($Action)
	{
		switch($Action)
		{
			case 'new':
				$Display->Subtitle = 'Links &raquo; New link';
				$InitialHeading = " <h2> Add a new link &raquo;&raquo; </h2> ";
				$LinkName = $LinkURL = $LinkCategory = false;
				$Form = new AdminForm('option-link-update.php?action=link_new');
				//If there are errors from the option-link-action page, show them here
				if(isset($_GET['update']))
				{
					foreach($Error as $Key => $KeyValue)
					{
						$Form->Error[$Key] = $KeyValue;
					}
					$LinkName = $_POST['link_name'];
					$LinkURL = $_POST['link_url'];
					$LinkCategory = $_POST['link_category'];
				}
				$Form->Input('text', 'link_name', $LinkName, 'Link name', false);
				$Form->Input('text', 'link_url', $LinkURL, 'Link URL', 'The address of the link');
				$Form->Input('text', 'link_category', $LinkCategory, 'Category', false);
				print $InitialHeading.$Form->Finish('Add new link');
				break;
				
				
			case 'edit':
				$Display->Subtitle = 'Links &raquo; Edit Link';
				$InitialHeading = " <h2> Edit link &raquo;&raquo; </h2> ";
				$ID = $_GET['id'];
				//---------------------- Database query
				$LinkData = $DC->Select('link', 'link_id', $_GET['id']);
				//-------------------------------------
				$LinkName = $LinkData[0]['link_name'];
				$LinkURL = $LinkData[0]['link_url'];
				$LinkCategory = $LinkData[0]['link_category'];
				$Form = new AdminForm("option-link-update.php?action=link_edit&id=$ID");
				//If there are errors from the option-link-action page, show them here
				if(isset($_GET['update']))
				{
					foreach($Error as $Key => $KeyValue)
					{
						$Form->Error[$Key] = $KeyValue;
					}
					$LinkName = $_POST['link_name'];
					$LinkURL = $_POST['link_url'];
					$LinkCategory = $_POST['link_category'];
				}
				$Form->Input('text', 'link_name', $LinkName, 'Link name', false);
				$Form->Input('text', 'link_url', $LinkURL, 'Link URL', 'The address of the link');
				$Form->Input('text', 'link_category', $LinkCategory, 'Category', false);
				print $InitialHeading.$Form->Finish('Update Link');
				break;
				
				
			default:
				break;
		}
	}
	else
	{
		header("Location: option-link.php");
		exit();
	}
_foot()
?>
Return current item: Prsaar Social Networking Platform