jesushax Posted June 16, 2008 Share Posted June 16, 2008 hi below is my code upon ticking the desired checkbox and posting the form the action current should be applied but the table is not getting updated at all ive viewed the html the record values are getting added to the checkboxes but the case "current": doesnt work any ideas? Thanks <?php switch(@$_GET["action"]) { Case "delete": include($_SERVER['DOCUMENT_ROOT'] . '/includes/connection.php'); session_start(); $ID = $_GET["ID"]; mysql_query("DELETE FROM tblPortfolio WHERE PortID='$ID'") or die(mysql_error()); header("Location: /admin/portfolio/index.php"); break; Case "current"; include($_SERVER['DOCUMENT_ROOT'] . '/includes/connection.php'); session_start(); if(is_array($_POST['checkbox'])){ foreach($_POST['checkbox'] as $PortID){ mysql_query("UPDATE tblPortfolio SET PortCurrent='1' WHERE PortID='$ID'") or die(mysql_error()); } } header("Location: /admin/portfolio/current_projects.php"); break; Default: include($_SERVER['DOCUMENT_ROOT'] . '/includes/connection.php'); session_start(); include($_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'); include($_SERVER['DOCUMENT_ROOT'] . '/includes/admin_access.inc'); ?> <div id="subs-container"> <div id="subs"> <div id="subs-admin-text"> <div class="padding"> <ul> <li class="menu">Portfolio Menu:</li> <li class="menu"><a href="/admin/portfolio/add_project.php">Add</a></li> <li class="menu"><a href="/admin/portfolio/index.php">View/Edit</a></li> <li class="menu"><a href="/admin/portfolio/current_projects.php">Current Projects</a></li> </ul> </div> </div> </div> </div> <div id="lower-container"> <div id="backlinks"><?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/backlinks.php'); ?></div> <div id="content"> <div class="padding"> <h3>Portfolio</h3> <p>Edit, Archive and Delete Projects using the below navigation.</p> <?php $PortSQL = mysql_query("SELECT * FROM tblPortfolio WHERE PortCurrent='0' ORDER BY PortDateAdded DESC") or die(mysql_error()); echo '<form id="archive" method="post" action="'.$_SERVER['PHP_SELF'].'?action=current">'."\n"; echo '<table width="100%"><tr style="font-weight:bold;"><td class="center">Type</td><td>Project Title</td><td class="center">Date Added</td><td class="center">Date Modified</td><td class="center">Edit</td><td class="center">Current</td><td class="center">Delete</td></tr>'."\n"; while ($rsPort = mysql_fetch_array($PortSQL)) { echo '<tr><td class="center">'."\n"; echo substr($rsPort['PortType'],0,1); echo '</td><td>'."\n"; echo $rsPort["ClientCompany"]."</td><td class=\"center\">"."\n"; mydate($rsPort["PortDateAdded"]); echo'</td><td class="center">'."\n"; if (empty($rsPort["PortDateEdited"])) { echo " "; } else { mydate($rsPort["PortDateEdited"])."\n"; } echo '</td><td class="center"><a href="/admin/portfolio/edit_project.php?ID='.$rsPort["PortID"].' ">Edit</a></td>'."\n"; echo '<td style="text-align:center;">'."\n"; echo '<input name="checkbox[]" type="checkbox" value="'.$rsPort["PortID"].'" class="blank" /></td>'."\n"; echo '<td class="center"><a href="?action=delete&ID='.$rsPort["PortID"].' ">Delete</a></td>'."\n"; echo "</tr>"."\n"."\n"; } echo '<tr style="height:50px;"><td colspan="6" style="text-align:right;"><input type="submit" value="Add to Current Projects" /></td></tr> '."\n"; echo "</table></form>"."\n"; include($_SERVER['DOCUMENT_ROOT'] . '/includes/logged_footer.php'); break; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/110399-solved-current-action-not-working/ Share on other sites More sharing options...
jesushax Posted June 16, 2008 Author Share Posted June 16, 2008 nevermind seen it... Quote Link to comment https://forums.phpfreaks.com/topic/110399-solved-current-action-not-working/#findComment-566372 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.