Omni-X Posted December 25, 2007 Share Posted December 25, 2007 Hi im new to php and I have started to make a php 'email-system' based on mysql. I have the data being displayed but I cannot get it deleted! Ive tried everything, linking to another form, having a function inside the form and it wont get deleted. Closest I got it to if I manually inputted the sql statement it would delete a row from the database (so not really helpful at all). Anyways thanks for the help in Advance. Regards X My code is below: <?php session_start(); $table = "inbox"; $primaryKey = "inboxid"; // $table_array = array ("inboxid, "ipaddress", "datetime", "email", "number", "name", "message"); $i_query = "SELECT * FROM inbox"; $inbox_query = mysql_query($i_query) or die("mysql_query failed." . "<br>Error: " . mysql_error()); $inbox_numF = mysql_num_fields($inbox_query) or die("mysql_num_fields failed." . "<br>Error: " . mysql_error()); $inbox_numR = mysql_num_rows($inbox_query) or die("mysql_num_rows failed." . "<br>Error: " . mysql_error()); ?> <html> <head> <link rel="stylesheet" href="stylesheet.css"> </head> <body> <h1>Inbox</h1> <form action="" method="POST" id="inboxForm" name="inboxForm"> <table class="inbox"> <? // Prints the fields echo "<tr>"; echo "<th><input value='Delete' type='submit' id='deleteSubmit' name='deleteSubmit'></th>"; for($numF = 1; $numF < $inbox_numF; $numF++) { $inbox_fieldN[numF] = mysql_field_name($inbox_query, $numF); echo "<th class='inbox'>" . $inbox_fieldN[numF] . "</th>"; } echo "</tr>"; // Prints the rows while($inbox_fetchA = mysql_fetch_array($inbox_query)) { echo "<tr>"; if($inbox_fetchA[$primaryKey]) { $inboxID = $inbox_fetchA[$primaryKey]; echo "<td class='inbox'>"; // Prints the delete button echo $inboxID; echo "<input value='{$inboxID}' type='checkbox' name='checkbox[]'>"; echo "<input value='{$inboxID}' type='hidden' name='inboxIDHidden'>"; // echo "<input type='hidden' name='id[$i]' value='{$books['id']}' />"; echo "</td>"; // unset($inbox_fetchA[$primaryKey]); // Removes $inbox_fetchR[0] from the array } for($numR = 1; $numR <= $inbox_numR; $numR++) { echo "<td class='inbox'>$inbox_fetchA[$numR]</td>"; } echo "</tr>"; } ?> </table> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/83091-help-please/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.