Not Loading Function Into Div
         
               Posted on 
16th Feb 2014 07:03 pm by  
admin
        
        I'm not sure whether to put this under the php forum or ajax forum but because I tink it's more of an issue wit the php code itself I decided to put it here. I came across this file from a friend that said this file will work for me. Okay now basically I have the list of characters and when someone clicks on Add New it will load the addcharacter function. That's what I want it to do. However with all of this it will not load the function. Am I missing something somewhere?
Code: 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
      }
   }
}
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>Character Management</h1><br />';
    print "<h2 class=backstage>Characters :: <a href="#" onclick="ajaxpage('addcharacter', 'content'); return false;">Add New</a></h2><br />";
      $query = "SELECT 
            bio.charactername,
            bio.style_id,
            style.id,
            style.name
        FROM
            efed_bio as bio
        INNER JOIN
            efed_list_styles as style
        ON
            style.id = bio.style_id";            
     $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> </td>';
    print '<td>Character Name</td>';
    print '<td align=center width=100>Poser Name</td>';
    print '<td align=center width=60>Style</td>';
    print '<td align=center width=60>Alignment</td>';
    print '<td align=center width=60>Status</td>';
    print '</tr>';
        // Fetch and print all records.
        $i = 0;
        $current_row = 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=35><a href="#" onclick="ajaxpage('editcharacter', 'content'); return false;">Edit</a></td>";
            print "<td valign="top" align=center width=25><a href="#" onclick="ajaxpage('bio', 'content'); return false;">Bio</a></td>";
            printf ( "<td valign="top">%s</td>", $row ['charactername'] );
            printf ( "<td align="center" valign="top">%s</td>", $row ['posername'] );
            printf ( "<td align="center" valign="top">%s</td>", $row ['style_id'] );
            printf ( "<td align="center" valign="top">%s</td>", $row ['alignment_id'] );
            printf ( "<td align="center" valign="top">%s</td>", $row ['status_id'] );
            print '</tr>';
        }
         print '</table>';
     }
     else
     {
     print '<span>There are no characters.</span><br />';
     }
     print '<br />';
returnmain();
}
function addcharacter() {
print '<h1 class="backstage">Character Management</h1><br />';
print '<h2 class="backstage">Add New Character</h2><br />';
print '<form name="addcharacter" method="post" action="backstage.php" id="addcharacter">';
print '<table width="100%" class="table2">';
print '<tr>';
print '<td class="rowheading">Character Name:</td><td class="row3">';
print '<input type="text" name="charactername" class="fieldtext490" value=""></td>';
print '</tr>';
print '<tr>';
print '<td width="120" class="rowheading">Username:</td><td class="row3"><input type="text" name="username" class="fieldtext160"></td>';
print '</tr>';
print '<tr>';
print '<td width="120" class="rowheading">Poser name:</td><td class="row3"><input type="text" name="posername" class="fieldtext160" value=""></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Style:</td>';
print '<td class="row3"><select name="style" class="selection"><option value="0">- Select -</option>';
print '<option value="Singles">Singles</option><option value="Tag Team">Tag Team</option><option value="Stable">Stable</option><option value="Manager">Manager</option><option value="Referee">Referee</option><option value="Staff">Staff</option>';
print '</select></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Gender:</td>';
print '<td class="row3"><select name="gender" class="selection"><option value="0">- Select -</option>';
print '<option value="Male">Male</option><option value="Female">Female</option>';
print '</select></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Status:</td>';
print '<td class="row3"><select name="status" 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>Division:</td>';
print '<td class=row3><select name=division class="selection"><option value=0>- Select -</option>';
print '</select></td>';
print '</tr>';
print '<tr>';
print '<td class=rowheading>Alignment:</td>';
print '<td class="row3"><select name="alignment" class="selection"><option value="0">- Select -</option>';
print '<option value="Face">Face</option><option value="Heel">Heel</option><option value="Neutral">Neutral</option>';
print '</select></td>';
print '</tr>';
print '<tr>';
print '<td class="rowheading">Sort:</td>';
print '<td class="row3"><select name="sort" class="selection"><option value=0>- Select -<option value="A">A<option value="B">B<option value="C">C<option value="D">D<option value="E">E<option value="F">F<option value="G">G<option value="H">H<option value="I">I<option value="J">J<option value="K">K<option value="L">L<option value="M">M<option value="N">N<option value="O">O<option value="P">P<option value="Q">Q<option value="R">R<option value="S">S<option value="T">T<option value="U">U<option value="V">V<option value="W">W<option value="X">X<option value="Y">Y<option value="Z">Z<option value="0-9">0-9</select></td>';
print '</tr>';
print '</table><br />';
print '<input type="submit" value="Save Character" class="button" name="addcharacter"><br /><br />';
print '<input type="button" value="Return to Character List" class="button200"><br /><br />';
print '<h2 class="backstage"><input type="button" value="Return to Main Menu" class="button200"></form></h2>';
}
?>
</body>
</html>       
      
       
		No comments posted yet	
	Your Answer:
	        Login to answer
        
212   22
 22  
 
    
    
 
Other forums
Strange php code found on my website 
I got hacked and the following code was placed within my files:
Code: [Select]<?
/*
[newb] Image hosting help. 
Hey there, I'm new to php, I know some basics and i can code PWN, I'm only 14 but I'm interested in 
How to form a xml form table with a single sql statement..?   
Hi everyone,
            I don't know if this is going to be a duplicate thread but i couldn't 
Weird MySQL error, why am I recieving this? 
PHP Code:
<?php require "global_settings.php"; ?>
<titl
in php, link returns to the line 
When I add a link in a php page, the link word returns to the line (as a 
 would do)
Examp
Multi dimensional arrays 	 
If I put in this code:
1
2
3
4
5
6
7
8
9
10
11
12
13<
How do I give a developer access to a specific directory and nothing else? 
I want to give a develop access to a specific directory and nothing else
I can give them an F
Help Import Animoto and Youtube  
CAn someone help me urgently want to allow users on my website to import youtube/revver/dailymotion 
How to add advertisment on top of videos  
Hello,
I was told that i should find the answer for this problem in this forums.
I searched a 
PHP not creating file. 
Its supposed to create a .ini file in the /scriptfiles/users/ with the name they entered into the fi