Shamrox Posted February 11, 2008 Share Posted February 11, 2008 I'm trying to improve the interactivity of a table of data. Currently, I have a column that displays an image and when clicked it takes the users to a form for emailing a reminder. Right next to that is a button that clears that record from the table when that reminder has been emailed. I'd like to make it so that the user only has to click on the first button/image and as it takes them to the email form page, it also updates the record in the database and would clear it from the table based on the status field being set to Yes. Currently here is my code, but it's not updating the database status field at all. Here is the code for the two columns. <td align="center" class="tabletext"><a href="email_form.php?form=reminderconfirmation®istrarid=<?php echo $row_rs_reminder['registrarid']; ?>"><img src="images/icon_reminder.jpg" alt="Reminder Agreement" width="18" height="20" border="0" align="center"></a> <div align="center"></div></td> <td align="center" class="tabletext"> <form id="clear" name="clear" method="post" action="<?php echo $editFormAction; ?>"> <button type="submit"><img src="/mdwapp/images/0090_check.gif" alt="Check" width="12" height="12" border="0"></button><input name="registrarid" type="hidden" value="<?php echo $row_rs_reminder['registrarid']; ?>" /><input name="clearstatus" type="hidden" value="Yes" /> </form> </td> Here is my code for submitting to database, but this doesn't do anything and not sure why. <?php if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "clear")) { $updateSQL = sprintf("UPDATE spec_registrar SET clearstatus=%s WHERE registrarid=%s", GetSQLValueString($_POST['clearstatus'], "text"), GetSQLValueString($_POST['registrarid'], "int")); mysql_select_db($database_spectrum, $spectrum); $Result1 = mysql_query($updateSQL, $spectrum) or die(mysql_error()); $updateGoTo = "dashboard.php?page=reminder"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } ?> Can someone tell me how I'd put the two functions together and get it to update the status? Thanks. Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted February 11, 2008 Share Posted February 11, 2008 just make the link from the image to a php page that runs the delete function. click image and: <?php mysql_query("delete from...."); header("Location:theformemailpage.php"); ?> Quote Link to comment Share on other sites More sharing options...
Shamrox Posted February 11, 2008 Author Share Posted February 11, 2008 I had that method initially, but everytime the page loaded, it loaded blank and I couldn't figure out why Quote Link to comment Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 You probably had an error in your code and you don't have error reporting on. Chances are the HEADER was being sent after output to the screen. Quote Link to comment Share on other sites More sharing options...
Shamrox Posted February 11, 2008 Author Share Posted February 11, 2008 possibly post some simple code that i could expand on and test? Quote Link to comment Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 Turn on error reporting in the php.ini or use ini_set to enable it. Quote Link to comment 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.