Jump to content

Recommended Posts

I'm wanting to find out how I can pass along through the functions whether its a weekly event or ppv event. I'm thinking something like this for weekly event:

 

 <a href=\"#\" onclick=\"ajaxpage('addshowname', 'content, weeklyevent'); return false;\">

 

And then this for ppv event:

 

 <a href=\"#\" onclick=\"ajaxpage('addshowname', 'content, ppv'); return false;\">

 

But I don't even know if that is right and if it is don't I have to adjust my ajaxpage? Code for ajax is at the bottom.

 

function shownames() 
{
    print '<h1 class="backstage">Show Name Management</h1><br />';
    print "<h2 class=\"backstage\">Weekly Events :: <a href=\"#\" onclick=\"ajaxpage('addshowname', 'content'); return false;\">Add New</a></h2><br />";
    $query = "SELECT * FROM shownames WHERE `type` = 'Weekly Event' ORDER BY `name`";
    $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 width=1> </td>';
        print '<td width=30 align="center">Sort</td>';
        print '<td width=10> </td>';
        print '<td width=10> </td>';
        print '<td width=100 align="center">Short Name</td>';
        print '<td>Event Name</td>';
        print '<td align="center">Lineup Template</td>';
        print '<td align="center">Show Template</td>';
        print '</tr>';
        // 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=\"editshowname('editshowname', 'content' , '". $row ['showname'] ."'); return false;\">Edit</a></td>";
            printf ( "<td valign=\"top\" align=\"center\" width=\"30\">%s</td>", $row [id] );
            print "<td valign=\"top\" align=\"center\" width=\"10\"><a href=\"#\" onclick=\"ajaxpage('editshownames', 'content'); return false;\">Edit</a></td>";
            print "<td valign=\"top\" align=\"center\" width=\"10\"><a href=\"#\" onclick=\"ajaxpage('editshownames', 'content'); return false;\">Edit</a></td>";
            printf ( "<td valign=\"top\" align=\"center\">%s</td>", $row [shortname] );
            printf ( "<td valign=\"top\">%s</td>", $row [showname] );
            printf ( "<td valign=\"top\" align=\"center\">%s</td>", $row [lineup] );
            printf ( "<td valign=\"top\" align=\"center\">%s</td>", $row [template] );
            print '</tr>';
        }
        echo '</table>';
    }
    else 
    {
    print '<span>There are no shows.</span><br />';
    }
    print '<br />';
       print "<h2 class=\"backstage\">PPV Events :: <a href=\"#\" onclick=\"ajaxpage('addshowname', 'content'); return false;\">Add New</a></h2><br />";
    $query = "SELECT * FROM shownames WHERE `type` = 'PPV' ORDER BY `name`";
    $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 width=1> </td>';
        print '<td width=30 align="center">Sort</td>';
        print '<td width=10> </td>';
        print '<td width=10> </td>';
        print '<td width=100 align="center">Short Name</td>';
        print '<td>Event Name</td>';
        print '<td align="center">Lineup Template</td>';
        print '<td align="center">Show Template</td>';
        print '</tr>';
        // 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=\"editshowname('editshowname', 'content' , '". $row ['showname'] ."'); return false;\">Edit</a></td>";
            printf ( "<td valign=\"top\" align=\"center\" width=\"30\">%s</td>", $row [id] );
            print "<td valign=\"top\" align=\"center\" width=\"10\"><a href=\"#\" onclick=\"ajaxpage('editshownames', 'content'); return false;\">Edit</a></td>";
            print "<td valign=\"top\" align=\"center\" width=\"10\"><a href=\"#\" onclick=\"ajaxpage('editshownames', 'content'); return false;\">Edit</a></td>";
            printf ( "<td valign=\"top\" align=\"center\">%s</td>", $row [shortname] );
            printf ( "<td valign=\"top\">%s</td>", $row [showname] );
            printf ( "<td valign=\"top\" align=\"center\">%s</td>", $row [lineup] );
            printf ( "<td valign=\"top\" align=\"center\">%s</td>", $row [template] );
            print '</tr>';
        }
        echo '</table>';
    }
    else 
    {
    print '<span>There are no shows.</span><br />';
    }
    print '<br />';
    print '<h2 class="backstage"><input type="button" value="Return to Main Menu" class="button200"></form></h2>';
} 

 

 

function addshowname() {
    print '<h1 class=backstage>Show Name Management</h1><br />';
    print '</table><br />';
    print '<h2 class=backstage>Show Name Editor</h1><br />';
    print '<form name="addshowname" method="post" action="backstage.php" id="addshowname">';
    print '<table width="100%" class="table2">';
    print '<tr>';
    print '<td width=120 class=rowheading valign=center>Show Name:</td>';
    print '<td class=row3><input type=text name=eventname class=fieldtext490></td>';
    print '</tr>';
    print '<tr>';
    print '<td width=120 class=rowheading valign=center>Short Name:</td>';
    print '<td class=row3><input type=text name=shortname class=fieldtext140></td>';
    print '</tr>';
    print '<tr>';
    print '<td width=120 class=rowheading valign=center>Show Lineup:</td>';
    print '<td class=row3><input type=text name=showlineup class=fieldtext140></td>';
    print '</tr>';
    print '<tr>';
    print '<td width=120 class=rowheading valign=center>Show Template:</td>';
    print '<td class=row3><input type=text name=template class=fieldtext140></td>';
    print '</tr>';
    print '<tr>';
    print '</table><br />';
    print '<input type="submit" value="Save Show Name" class="button" name="addshowname"><br /><br />';
    print '<input type=submit value="Return to Show Name List" class=button200><br /><br />';
    print '<h2 class=backstage><input type=submit value="Return to Main Menu" class=button200></form></h2>';
}

 

ajax.js

var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid, usernameid)
{
url = 'backstagefunctions.php?userid=' + usernameid + '&f=' + url;

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
	}
}
}

function WrestlerList()
{
var addWrestler = document.getElementById("character_selection").value
if (addWrestler) {
// Here we append a new wrestler to your hidden field using a comma
document.getElementById("chars").value += addWrestler+",";
// Continue your original functionality
document.getElementById("characterlist").innerHTML += "<li>" +
addWrestler + "</li>";
return WrestlerList;
}
}

Link to comment
https://forums.phpfreaks.com/topic/179640-sending-variables-through-functions/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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