Page 1 of 1

Changing Order of Titles

Posted: Tue Feb 10, 2009 9:24 pm
by CoolAsCarlito
This is what I want to find out how to implement into my function is the ability to click one of these buttons and have it be able to go up or down on a list of other titles. I'm sure by figuring out the extra tags one can understand what it's supposed to do.

Code: Select all

function titles() 
{
    print '<h1 class="backstage">Title Management</h1><br />';
    print "<h2 class=\"backstage\">Titles :: <a href=\"#\" onclick=\"ajaxpage('addtitle', 'content'); return false;\">Add New</a></h2><br />";
    $query = "SELECT * FROM titles 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>&nbsp;</td>';
        print '<td width="40" align="center">Order</td>';
        print '<td>&nbsp;</td>';
        print '<td>&nbsp;</td>';
        print '<td width="100" align="center">Shortname</td>';
        print '<td>Name</td>';
        print '<td align="center" width="50">Style</td>';
        print '<td align="center" width="40">Active</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=\"edittitle('edittitle', 'content' , '". $row ['name'] ."'); return false;\">Edit</a></td>";
            printf ( "<td align=\"center\" valign=\"top\" width=\"40\">%s</td>", $row [order] );
            print "<td valign=\"top\" align=\"center\" width=\"30\"><a href=\"#\" onclick=\"edittitle('edittitle', 'content' , '". $row ['name'] ."'); return false;\">Edit</a></td>";
            print "<td valign=\"top\" align=\"center\" width=\"30\"><a href=\"#\" onclick=\"edittitle('edittitle', 'content' , '". $row ['name'] ."'); return false;\">Edit</a></td>";
            printf ( "<td align=\"center\" valign=\"top\" width=\"100\">%s</td>", $row [shortname] );
            printf ( "<td valign=\"top\">%s</td>", $row [name] );
            printf ( "<td valign=\"top\" width=\"50\" align=\"center\" >%s</td>", $row [style] );
            printf ( "<td align=\"center\" valign=\"top\" width=\"40\">%s</td>", $row [active] );
            print '</tr>';
        }
        echo '</table>';
    }
    else 
    {
    print '<span>There are no titles.</span><br />';
    }
    print '<br />';
    print '<h2 class="backstage"><input type="button" value="Return to Main Menu" class="button200"></form></h2>';
}  

Code: Select all

<form method=post><input type=hidden name=action value=title><input type=hidden name=up value=yes><input type=hidden name=titleid value=13><input type=hidden name=sortorder value=2><input type=submit value=&uarr; class=button15></form>

Code: Select all

<form method=post><input type=hidden name=action value=title><input type=hidden name=down value=yes><input type=hidden name=titleid value=13><input type=hidden name=sortorder value=2><input type=submit value=&darr; class=button15></form>