Jump to content

Recommended Posts

My question is when I click on the edit for a division in the list of divisions how do I pass the variable of which division it is. I had it once before but lost the original for some stupid reason. I think I had to have the variable like $division inside the () for editdivisions but I don't remember.

 

This is my list of divisions:

 

function divisions() {
    print '<h1 class="backstage">Division Management</h1><br />';
    print "<h2 class=backstage>Divisions :: <a href=\"#\" onclick=\"ajaxpage('adddivision', 'content'); return false;\">Add New</a></h2><br />";
  $query = "SELECT * FROM divisions ORDER BY `division`";
     $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 [division] );
             print '</tr>';
         }
         echo '</table>';
     }
     else
     {
     print '<span>There are no divisions.</span><br />';
     }
     print '<br />';
     print '<h2 class="backstage"><input type="button" value="Return to Main Menu" class="button200"></form></h2>';
}

 

 

This is my edit division function:

 

function editdivision() 
{
    $division = $_GET['division']; 
    $query = mysql_query("SELECT * FROM `division` WHERE `division` = '" . $division . "'");
      $row = mysql_fetch_array($query);
    print '<h1 class="backstage">Division Management</h1><br />';
    print '<h2 class="backstage">Edit Division</h2><br />';
    print '<form name="editmatchtype" method="post" action="backstage.php" id="editmatchtype">';    
    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=\"".$row['division']."\"></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="hidden" name="division" value="'.$division.'">'; 
    print '<input type="hidden" name="olddivision" value="'.$row['division'].'">';
    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 />';
    print '<h2 class=backstage><input type="button" value="Return to Main Menu" class="button200"></form></h2>';
    print '</center>';
} 

Link to comment
https://forums.phpfreaks.com/topic/179550-editing-information/
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.