Multiple Options for a Single Page


Posted on 16th Feb 2014 07:03 pm by admin

For this example I want to use the Handlers option which is under Fed Admin and all the related coding to the handlers option is found on the handlers.php page which includes a list of handlers with a hyperlink to a form to add a new handler and also hyperlinks next to each handlers name to where you can edit the handler's information. I'll include the handlers.php page at the bottom so you can see what I'm talking about. I want to know how to follow this same coding so that since you can see that the list of handlers is on handers.php file and it's option 0 then tell the handlers.php file that above the coding that that whole thing is option 0 because there's going to be other options for the handlers.php file. Like the add handler form is going to be option 1 and then edit handler is going to be option 2.


Code: <?php
print "<script type="text/javascript" language="javascript">n";
print "function executeform(action,option) {n";
print "document.mainmenu.action.value = action;n";
print "document.mainmenu.option.value = option;n";
print "document.mainmenu.submit();n";
print "}n";
print "</script>n";

if ((isset($userid)) && ($userid > "0") && ($defaultcharacterid > "0"))
{
print "<h1>Character</h1>n";
print "<ul>n";
print "<li";
if (($action == "character") && ((isset($option)) && ($option == "2"))) { print " class=active"; }
print "><a href="#" onClick="executeform('character','2');">Bio</a></li>n";
print "<li";
if (($action == "alliesrivals") && ((isset($option)) && ($option == "0"))) { print " class=active"; }
print "><a href="#" onClick="executeform('alliesrivals','0');">Allies</a></li>n";
print "<li";
if (($action == "alliesrivals") && ((isset($option)) && ($option == "1"))) { print " class=active"; }
print "><a href="#" onClick="executeform('alliesrivals','1');">Rivals</a></li>n";
print "<li";
if ($action == "quotes") { print " class=active"; }
print "><a href="#" onClick="executeform('quotes','0');">Quotes</a></li>n";
print "</ul>n";

print "<h1>Submit</h1>n";
print "<ul>n";
print "<li";
if ($action == "roleplay") { print " class=active"; }
print "><a href="#" onClick="executeform('roleplay','0');">Roleplay</a></li>n";
print "<li";
if ($action == "news") { print " class=active"; }
print "><a href="#" onClick="executeform('news','0');">News</a></li>n";
print "<li";
if ($action == "submitmatch") { print " class=active"; }
print "><a href="#" onClick="executeform('submitmatch','0');">Match</a></li>n";
print "<li";
if ($action == "submitseg") { print " class=active"; }
print "><a href="#" onClick="executeform('submitseg','0');">Seg</a></li>n";
print "</ul>n";
}

if ((isset($isadmin)) && ($isadmin == "1"))
{
print "<h1>Fed Head</h1>n";
print "<ul>n";
print "<li";
if ($action == "directory") { print " class=active"; }
print "><a href="#" onClick="executeform('directory','0');">Directory</a></li>n";
}

if ((isset($isadmin)) && ($isadmin == "1"))
{
print "<h1>Booking</h1>n";
print "<ul>n";
print "<li";
if ($action == "champions") { print " class=active"; }
print "><a href="#" onClick="executeform('champions','0');">Champions</a></li>n";
print "<li";
if ($action == "eventbooker") { print " class=active"; }
print "><a href="#" onClick="executeform('eventbooker','0');">Booker</a></li>n";
print "<li";
if (($action == "resultscompilation") && ((isset($option)) && ($option == "0"))) { print " class=active"; }
print "><a href="#" onClick="executeform('resultscompilation','0');">Compiler</a></li>n";
print "<li";
if (($action == "resultscompilation") && ((isset($option)) && ($option == "1"))) { print " class=active"; }
print "><a href="#" onClick="executeform('resultscompilation','1');">Archives</a></li>n";
print "</ul>n";

print "<h1>Fed Admin</h1>n";
print "<ul>n";
print "<li";
if ($action == "handler") { print " class=active"; }
print "><a href="#" onClick="executeform('handler','0');">Handlers</a></li>n";
print "<li";
if (($action == "character") && ((isset($option)) && ($option == "1"))) { print " class=active"; }
print "><a href="#" onClick="executeform('character','1');">Characters</a></li>n";
print "<li";
if ($action == "manageapplications") { print " class=active"; }
print "><a href="#" onClick="executeform('manageapplications','0');">Applications</a></li>n";
print "<li";
if ($action == "eventname") { print " class=active"; }
print "><a href="#" onClick="executeform('eventname','0');">Event Names</a></li>n";
print "<li";
if ($action == "title") { print " class=active"; }
print "><a href="#" onClick="executeform('title','0');">Title Names</a></li>n";
print "<li";
if ($action == "division") { print " class=active"; }
print "><a href="#" onClick="executeform('division','0');">Divisions</a></li>n";
print "<li";
if ($action == "arenas") { print " class=active"; }
print "><a href="#" onClick="executeform('arenas','0');">Arenas</a></li>n";
print "</ul>n";

print "<h1>Site Admin</h1>n";
print "<ul>n";
print "<li";
if ($action == "template") { print " class=active"; }
print "><a href="#" onClick="executeform('template','0');">Templates</a></li>n";
print "<li";
if ($action == "content") { print " class=active"; }
print "><a href="#" onClick="executeform('content','0');">Content</a></li>n";
print "<li";
if ($action == "biolayout") { print " class=active"; }
print "><a href="#" onClick="executeform('biolayout','0');">Bio Configuration</a></li>n";
print "<li";
if ($action == "newscategory") { print " class=active"; }
print "><a href="#" onClick="executeform('newscategory','0');">News Categories</a></li>n";
print "<li";
if ($action == "menustructures") { print " class=active"; }
print "><a href="#" onClick="executeform('menustructures','0');">Menus</a></li>n";
print "</ul>n";
?>
}


Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="" />

<title>Untitled 1</title>
</head>

<body>

<?php {
print '<h1 class=backstage>Handler Management</h1><br />';
print "<h2 class="backstage">Handlers :: <a href="#" onclick="ajaxpage('addhandler', 'content'); return false;">Add New</a></h2><br />";
print '<table width="100%" class="table1">';
print '<tr class="rowheading">';
print '<td width="30">&nbsp;</td>';
print '<td align="center">Username</td>';
print '<td align="center">Surname</td>';
print '<td align="center">First Name</td>';
print '<td align="center">E-Mail</td>';
print '</tr>';
$query = "SELECT * FROM efed_handler ORDER BY `login`";
$result = mysql_query ( $query ); // Run The Query
if ($result) {
// Fetch and print all records.
$i = 0;
while ( $row = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) {
$sClass = 'row2';
if ($i ++ & 1) {
$sClass = 'row1';
}
printf ( "<tr class="%s">", $sClass );
print "<td valign="top" align="center" width="30"><a href="#" onclick="ajaxpage('edithandler', 'content'); return false;">Edit</a></td>";

printf ( "<td valign="top" align="center">%s</td>", $row [login] );
printf ( "<td valign="top" align="center">%s</td>", $row [surname] );
printf ( "<td valign="top" align="center">%s</td>", $row [firstname] );
printf ( "<td valign="top" align="center">%s</td>", $row [email] );
print '</tr>';
}
}
print '</table><br />';
print '<h2 class=backstage><form method=POST><input type=hidden name=action value=mainmenu><input type=submit value="Return to Main Menu" class=button200></form></h2>';
}
?>
</body>
</html>
?>

<?php
print '<h1 class="backstage">Handler Management</h1><br />';
print '<h2 class="backstage">Add New Handler Account</h2><br />';
print '<form name="addhandler" method="post" action="backstage.php" id="addhandler">';
print '<table width="100%" class="table2">';
print '<tr>';
print '<td width="120" class="rowheading">Username:</td><td class="row3"><input type="text" name="login" class="fieldtext490"></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Password:</td><td class="row3"><input type="password" name="password" class="fieldtext490"></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Surname:</td><td class="row3">';
print '<input type="text" name="surname" class="fieldtext490"></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Firstname:</td>';
print '<td class="row3"><input type="text" name="firstname" class="fieldtext490"></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Email:</td>';
print '<td class="row3"><input type="text" name="email" class="fieldtext490"></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">AIM:</td>';
print '<td class="row3"><input type="text" name="aim" class="fieldtext490"></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">MSN:</td>';
print '<td class="row3"><input type="text" name="msn" class="fieldtext490"></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Forum ID:</td>';
print '<td class="row3"><input type="text" name="forumid" class="fieldtext490"></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Account:</td>';
print '<td class="row3"><select name="account" class="selection"><option value="0">- Select -</option>';
print '<option value="Active">Active</option><option value="Inactive">Inactive</option>';
print '</select></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Administrator:</td>';
print '<td class="row3"><select name="admin" class="selection"><option value="0">- Select -</option>';
print '<option value="2">No</option><option value="1">Yes</option>';
print '</select></td>';
print '</tr>';
print '</table><br />';
print '<input type="submit" value="Save Handler" class="button" name="addhandler"><br /><br />';
print '<input type="submit" value="Return to Handler List" class="button200"><br /><br />';
print '<script type="text/javascript" src="ajax.js"></script>';
print '<h2 class="backstage">Characters<br /><br />';
print '<select name="characterid" class="dropdown" id="character_selection">';
print '<option value="">- Select -</option>';
$query = 'SELECT charactername FROM characters';
$result = mysql_query ( $query );
while ( $row = mysql_fetch_assoc ( $result ) ) {
print "<option value="".$row['charactername']."">".$row['charactername']."</option>r";
}
print '</select>&nbsp;&nbsp;<input type="hidden" id="chars" name="chars" value=""><input type="button" value="Add" onclick="WrestlerList()" class="button"></h2><br />';
print '<ul id="characterlist"></ul><br /></form&

No comments posted yet

Your Answer:

Login to answer
258 Like 10 Dislike
Previous forums Next forums
Other forums

Get to know your fellow coder
I think it's time we got personal around here. There's a lot of code swapping and a few members kno

limitations on array_unique()
Does any one know what/how imitations are applied to array_unique? I have an issue where no matter h

if else problem, help please
i have this script that i made only i try to also put in a if else for for some reason the script is

Escape Latin Characters
I need to escape latin characters in an xml doc. Example: "é" is escaped to "é". I thoug

Working with Dates, help.
Sooo to make a long story short, here's what im trying to accomplish.

I need to create a drop

Got A Free Server :(
So I was given a free server

http://shopping.yahoo.com/p:Compaq%20ProLiant%201500%20Server:1

problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html &quo

Odd or Even
Inside of a while loop I need to echo several rows of info...easy enough.

In the loop (for th

Table control is disappearing from Screen
Hi Experts,

I have a screen with multiple table control(TC). Each table control has two c

rand() function
just a general question guys a girls, is the rand() function 100% random or is it based on time?

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash