Xtremer360 Posted October 29, 2009 Share Posted October 29, 2009 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>'; } Quote Link to comment https://forums.phpfreaks.com/topic/179550-editing-information/ Share on other sites More sharing options...
MadTechie Posted October 29, 2009 Share Posted October 29, 2009 With out seeing the ajaxpage script i'm going to guess So shouldn't $division = $_GET['division']; be $division = $_GET['content']; Quote Link to comment https://forums.phpfreaks.com/topic/179550-editing-information/#findComment-947459 Share on other sites More sharing options...
Xtremer360 Posted October 29, 2009 Author Share Posted October 29, 2009 No it wouldn't. I know it wouldn't. Quote Link to comment https://forums.phpfreaks.com/topic/179550-editing-information/#findComment-947463 Share on other sites More sharing options...
MadTechie Posted October 29, 2009 Share Posted October 29, 2009 Okay well without more info I'm out of guesses then... Quote Link to comment https://forums.phpfreaks.com/topic/179550-editing-information/#findComment-947468 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.