Xtremer360 Posted November 30, 2009 Share Posted November 30, 2009 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. <?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"; ?> } <!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"> </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> <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>'; print '<h2 class="backstage"><form method="post"><input type="submit" value="Return to Main Menu" class="button200"></form></h2>'; ?> <?php print '<h1 class=backstage>Handler Management</h1><br />'; print '<h2 class=backstage>Edit Handler Details</h2><br />'; print '<form name="edithandler" method="post" action="backstage.php" id="edithandler">'; 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 value="'.$row['username'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Password:</td><td class=row3><input type=password name=password class=fieldtext490 onfocus="this.select()" value=""></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Surname:</td><td class=row3>'; print '<input type=text name=surname class=fieldtext490 value="'.$row['surname'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Firstname:</td>'; print '<td class=row3><input type=text name=firstname class=fieldtext490 value="'.$row['firstname'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Email:</td>'; print '<td class=row3><input type=text name=email class=fieldtext490 value="'.$row['email'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>AIM:</td>'; print '<td class=row3><input type=text name=aim class=fieldtext490 value="'.$row['aim'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>MSN:</td>'; print '<td class=row3><input type=text name=msn class=fieldtext490 value="'.$row['msn'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Forum ID:</td>'; print '<td class=row3><input type=text name=forumid class=fieldtext490 value="'.$row['forumid'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Account:</td>'; print '<td class=row3><select name=enabled class=selection>'; print '<option value=1>Enabled</option><option value=0>Disabled</option>'; print '</select></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Administrator:</td>'; print '<td class=row3><select name=isadministrator class=selection>'; print '<option value=1>Yes</option><option value=0>No</option>'; print '</select></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Default Character:</td>'; print '<td class=row3></td>'; print '</tr>'; print '</table><br />'; print '<input type=checkbox name=deletehandler> <span class=table1heading>Delete Handler?</span><br /><br />'; print '<input type="submit" value="Save Handler" class="button" name="edithandler"></form><br />'; print '<form method=POST><input type=hidden name=action value=handler><input type=submit value="Return to Handler List" class=button200></form><br />'; print '<h2 class=backstage>Characters<br /><br /><form method=post><input type=hidden name=action value=handler><input type=hidden name=routine value=addcharacter><input type=hidden name=option value=0><input type=hidden name=id value="130"><select name=characterid class=dropdown>'; print '<option value=0>- Select -</select> <input type=submit value="Add" class=button></form></h2><br />'; print '<br /><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>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/ Share on other sites More sharing options...
Xtremer360 Posted November 30, 2009 Author Share Posted November 30, 2009 I just noticed I have a small mistake in my coding. I'm pretty sure it should be this: print "<h2 class=\"backstage\">Handlers :: <a href=\"#\" onclick=\"ajaxpage('handler', '1'); return false;\">Add New</a></h2><br />"; And... print "<td valign=\"top\" align=\"center\" width=\"30\"><a href=\"#\" onclick=\"ajaxpage('handler', '2'); return false;\">Edit</a></td>"; Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-967992 Share on other sites More sharing options...
Xtremer360 Posted November 30, 2009 Author Share Posted November 30, 2009 I was able to come up with this code with some generous help however the links for Add New and Edit are not working. Nothing happens when you click the links. Anybody see why? <?php if ($option == 0 ) { print '<h1 class=backstage>Handler Management</h1><br />'; print "<h2 class=\"backstage\">Handlers :: <a href=\"#\" onclick=\"ajaxpage('handler', '1'); return false;\">Add New</a></h2><br />"; print '<table width="100%" class="table1">'; print '<tr class="rowheading">'; print '<td width="30"> </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('handler', '2'); 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>'; } elseif ( $option == 1) { 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> <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>'; print '<h2 class="backstage"><form method="post"><input type="submit" value="Return to Main Menu" class="button200"></form></h2>'; } elseif ( $option == 2) { print '<h1 class=backstage>Handler Management</h1><br />'; print '<h2 class=backstage>Edit Handler Details</h2><br />'; print '<form name="edithandler" method="post" action="backstage.php" id="edithandler">'; 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 value="'.$row['username'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Password:</td><td class=row3><input type=password name=password class=fieldtext490 onfocus="this.select()" value=""></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Surname:</td><td class=row3>'; print '<input type=text name=surname class=fieldtext490 value="'.$row['surname'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Firstname:</td>'; print '<td class=row3><input type=text name=firstname class=fieldtext490 value="'.$row['firstname'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Email:</td>'; print '<td class=row3><input type=text name=email class=fieldtext490 value="'.$row['email'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>AIM:</td>'; print '<td class=row3><input type=text name=aim class=fieldtext490 value="'.$row['aim'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>MSN:</td>'; print '<td class=row3><input type=text name=msn class=fieldtext490 value="'.$row['msn'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Forum ID:</td>'; print '<td class=row3><input type=text name=forumid class=fieldtext490 value="'.$row['forumid'].'"></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Account:</td>'; print '<td class=row3><select name=enabled class=selection>'; print '<option value=1>Enabled</option><option value=0>Disabled</option>'; print '</select></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Administrator:</td>'; print '<td class=row3><select name=isadministrator class=selection>'; print '<option value=1>Yes</option><option value=0>No</option>'; print '</select></td>'; print '</tr>'; print '<tr>'; print '<td class=rowheading>Default Character:</td>'; print '<td class=row3></td>'; print '</tr>'; print '</table><br />'; print '<input type=checkbox name=deletehandler> <span class=table1heading>Delete Handler?</span><br /><br />'; print '<input type="submit" value="Save Handler" class="button" name="edithandler"></form><br />'; print '<form method=POST><input type=hidden name=action value=handler><input type=submit value="Return to Handler List" class=button200></form><br />'; print '<h2 class=backstage>Characters<br /><br /><form method=post><input type=hidden name=action value=handler><input type=hidden name=routine value=addcharacter><input type=hidden name=option value=0><input type=hidden name=id value="130"><select name=characterid class=dropdown>'; print '<option value=0>- Select -</select> <input type=submit value="Add" class=button></form></h2><br />'; print '<br /><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>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-968327 Share on other sites More sharing options...
lemmin Posted November 30, 2009 Share Posted November 30, 2009 Probably an error in your ajaxpage() function. Can you post the code for that? Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-968334 Share on other sites More sharing options...
Xtremer360 Posted November 30, 2009 Author Share Posted November 30, 2009 var loadedobjects="" var rootdomain="http://"+window.location.hostname function ajaxpage(url, containerid) { var page_request = false if (window.XMLHttpRequest) // if Mozilla, Safari etc page_request = new XMLHttpRequest() else if (window.ActiveXObject) { // if IE try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } catch (e) { try { page_request = new ActiveXObject("Microsoft.XMLHTTP") } catch (e) { } } } else { return false } page_request.onreadystatechange=function() { loadpage(page_request, containerid) } page_request.open('GET', url, true) page_request.send(null) } function loadpage(page_request, containerid) { if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) document.getElementById(containerid).innerHTML=page_request.responseText } function loadobjs() { if (!document.getElementById) return for (i=0; i<arguments.length; i++) { var file=arguments[i] var fileref="" if (loadedobjects.indexOf(file)==-1) { //Check to see if this object has not already been added to page before proceeding if (file.indexOf(".js")!=-1) { //If object is a js file fileref=document.createElement('script') fileref.setAttribute("type","text/javascript"); fileref.setAttribute("src", file); } else if (file.indexOf(".css")!=-1) { //If object is a css file fileref=document.createElement("link") fileref.setAttribute("rel", "stylesheet"); fileref.setAttribute("type", "text/css"); fileref.setAttribute("href", file); } } if (fileref!="") { document.getElementsByTagName("head").item(0).appendChild(fileref) loadedobjects+=file+" " //Remember this object as being already added to page } } } Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-968337 Share on other sites More sharing options...
Xtremer360 Posted November 30, 2009 Author Share Posted November 30, 2009 Anybody seeing an issue with it? Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-968530 Share on other sites More sharing options...
Xtremer360 Posted December 1, 2009 Author Share Posted December 1, 2009 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-968725 Share on other sites More sharing options...
lemmin Posted December 1, 2009 Share Posted December 1, 2009 I don't see anything obvious in that function. When you load the page, does it say there are error? That could keep the javascript from working. Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-969135 Share on other sites More sharing options...
Xtremer360 Posted December 1, 2009 Author Share Posted December 1, 2009 No it doesn't do anything. I was given some help on some other forums here's the new bit of code. <?php if ($option == 0 ) { print '<h1 class=backstage>Division Management</h1><br />'; print "<h2 class=\"backstage\">Divisions :: <a href=\"#\" onclick=\"ajaxpage('backstage_libs/division.php', '1'); return false;\">Add New</a></h2><br />"; { $query = "SELECT * FROM efed_list_divisions"; $result = mysql_query ( $query ); // Run The Query $rows = mysql_num_rows($result); if ($rows > 0) { print '<table width="100%" class="table1">'; print '<tr class="rowheading">'; print '<td> </td>'; print '<td>Name</td>'; print '</tr>'; // Fetch and print all records. $i = 0; $current_row = 0; while ( $row = mysql_fetch_array ( $result, MYSQL_ASSOC ) ) { $current_row++; $sClass = 'row2'; if ($i ++ & 1) { $sClass = 'row1'; } printf ( "<tr class=\"%s\">", $sClass ); print "<td valign=\"top\" align=\"center\" width=\"30\"><a href=\"#\" onclick=\"ajaxpage('editdivision', 'content', '".$row['division']."'); return false;\">Edit</a></td>"; printf ( "<td valign=\"top\">%s</td>", $row [name] ); print '</tr>'; } print '</table>'; } else { print '<span>There are no divisions.</span><br />'; } print '<br />'; returnmain(); } } elseif ( $option == 1) { print '<h1 class=backstage>Division Management</h1><br />'; print '<h2 class=backstage>Add New Division</h2><br />'; print '<form name="adddivision" method="post" action="backstage.php" id="adddivision">'; print '<table width="100%" class="table2">'; print '<tr>'; print '<td width=120 class=rowheading valign=center>Division Name:</td><td class=row3><input type=text name=divisionname class=fieldtext490></td>'; print '</tr>'; print '</table><br />'; print '<input type="submit" value="Save Division" class="button" name="adddivision"></form><br />'; print '<form method=POST><input type=hidden name=action value=division><input type=submit value="Return to Division List" class=button200></form><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>'; } elseif ( $option == 2) { print'<h1 class="backstage">Division Management</h1><br />'; print'<h2 class="backstage">Edit Division</h2><br />'; print'<form name="editdivision" method="post" action="backstage.php" id="editdivision">'; print'<table width="100%" class="table2">'; print'<tr>'; print'<td width="120" class="rowheading" valign="center">Division:</td><td class="row3"><input type="text" name="division" class="fieldtext490" value=""></td>'; print'</tr>'; print'</table><br />'; print'<center>'; print'<input type="checkbox" name="deletedivision"><span class="table1heading">Delete Division?</span><br /><br />'; print'<input type="submit" value="Edit Division" class=button name="editdivision"><br /><br />'; print'<input type="button" value="Return to Divisions List" class="button200"><br /><br />'; returnmain(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-969201 Share on other sites More sharing options...
Xtremer360 Posted December 1, 2009 Author Share Posted December 1, 2009 I sent you a PM with more info. Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-969209 Share on other sites More sharing options...
Xtremer360 Posted December 2, 2009 Author Share Posted December 2, 2009 I added this code to the top of divisions.php file because I thought would have helped fix my problem but that didn't work either. Any other suggestions. <?php { if ((!empty($_POST)) && (isset($_POST['option']))) { require "backstageconfig.php"; $option=$_POST['option']; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-969562 Share on other sites More sharing options...
Xtremer360 Posted December 2, 2009 Author Share Posted December 2, 2009 Any other ideas? Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-969983 Share on other sites More sharing options...
Xtremer360 Posted December 3, 2009 Author Share Posted December 3, 2009 I'm to the point with working on this by myself and trying different ways for it to work and it not working then I'm willing to pay someone to come up with a solution to this issue. Free money just for finding a solution. Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-970164 Share on other sites More sharing options...
RossF.72 Posted December 3, 2009 Share Posted December 3, 2009 I'm to the point with working on this by myself and trying different ways for it to work and it not working then I'm willing to pay someone to come up with a solution to this issue. Free money just for finding a solution. Then what? Struggling for another few weeks on the next problem and offering more money when you can't solve that either? Like I told you before you went and stole the un-encrypted bits of my code and the database schema to try and get ahead in what you are doing, get a book and work through it, or if you can't get a book, there are hundreds/thousands of tutorial websites out there. Breaking things down into little bits a t a time, php.net is a great start. I spend loads of time there, as would a reasonable number of other people here. Learn the basic functions, and invent your own way of doing some of these things, or at least gain a basic understanding of what it is you are trying to do. You are wasting a stunningly mind-blowingly phenomenal amount of time - both yours and that of people who are trying to help you - by trying to work out the most simple stuff, like a navigation button to go to the next page of a garden variety web form. There's no great secret to this stuff, you are having problems with it because the way it is done in my script is with my personal preferences, built up over a few years of tinkering with this project and others... and going through books and online tutorials and learning functions bit by bit. You've lost a bit over 3 weeks now for a few simple reasons - one is a very simple security measure I put in the function files so that they can only be executed from the main admin panel file and not using a browser to go directly to the file, the others I don't like using $_GET to switch between pages in the admin panel - it leaves evidence in browsers of what the user has been doing, and I do like using hyperlinks instead of submit buttons, so to make that work requires a little bit of javascript to pass form data. Some seasoned people would call it unnecessary code-bloat, but the code you have and are trying to copy is not intended to be posted all over the web for feedback and help to get it working, so what they might think of it doesn't really matter. You don't have to use any of those techniques to make the script you are trying to make, but you are spending so much time trying to replicate, that you can't see that. Again, learn basic functions from a book or a tutorial site and develop your own techniques, it will be quicker for you. You've already wasted a year. There is no law against you writing your own script, and asking questions for help when you get stuck. Asking the right questions with code that you understand what you are trying to do with it will get the job much faster than posting great slabs of my source code and asking the poor unsuspecting schmucks here and all the other places you posted it at to help you. Ask the wrong question and you lead the guys here way off track for what you are trying to do. The end result of that is as disrespectful of their time as it is to me for swiping my IP in the first place. Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-970209 Share on other sites More sharing options...
lemmin Posted December 4, 2009 Share Posted December 4, 2009 It is hard to say what about your buttons is not working. Your ajax function accepts a url of a file to run some kind of server-side actions. You are passing it a string that doesn't look like it is a file so that might not even be doing anything. Also, the new code you posted is passing three arguments to that function and, unless you changed the ajax function, it should only be accepting two. I think you might want to do some research on ajax and add some error handling to the code and go from there. Quote Link to comment https://forums.phpfreaks.com/topic/183391-multiple-options-for-a-single-page/#findComment-971597 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.