gkishorekumarg Posted February 23, 2010 Share Posted February 23, 2010 Hi Experts! Please help me! Check this file attached Displaying all Members deta but. If we want Edit or Delete not working..... [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
aleX_hill Posted February 23, 2010 Share Posted February 23, 2010 Firstly, and a little off topic, look into using CSS to style your table cells rather then the way you are doing it now. Secondly, without seeing your editform.php and delete.php files, we cant help you. delete.php would look something like: include(connection.php); $query = "DELETE FROM star WHERE id='$_GET[id]'"; $result = mysql_query($query); if($result) echo "Deleted"; else echo "Not Deleted"; the editform.php would look similar to your add user form, but with some sql at the top and a few value="<?= $array['id'] ?>" in the form fields. Quote Link to comment Share on other sites More sharing options...
jay7981 Posted February 23, 2010 Share Posted February 23, 2010 i have something very similer, try this ... the view: <?php include 'connection.php'; include 'access.php'; $db = mysql_connect ($hostname, $username, $password) or die ('Failed to connect to database: ' . mysql_error()); mysql_select_db($database); $query = "SELECT * FROM table WHERE field = 1 ORDER BY field ASC"; $result = mysql_query($query) or die ('Failed to query ' . mysql_error()); ?> <form method="post" action="./process.php"> <table> <tr> <th scope="col"> </th> <th scope="col">Field</th> <th scope="col">Field</th> <th scope="col">Field</th> <th scope="col"> </th> </tr> <?php while ($row = mysql_fetch_assoc($result)) { $Field = $row['Field']; $Field = $row['Field']; $Field = $row['Field']; $Field = $row['Field']; ?> <tr> <td><input type="radio" name="Field" id="radio" value="<?php echo "$Field";?>"></td> <td><?php echo "$Field";?></td> <td><?php echo "$Field";?></td> <td><?php echo "$Field";?></td> <td><?php echo "$Field";?></td> </tr> <?php } ?> </table> <table> <tr> <td><input type="submit" name="submit[edit_confirm]" value="Edit"></td> <td><input type="submit" name="submit[delete_confirm]" value="Delete"></td> </tr> </table> </form> <?php mysql_free_result($result); mysql_close($db); ?> the process.php <?php $submit_array = array_keys($_POST['submit']); $action = $submit_array[0]; if ($_POST) { switch ($action) { case 'edit': include('./includes/functions/edit_go.php'); break; case 'edit_confirm': include('./includes/functions/edit.php'); break; case 'delete': include('./includes/functions/delete_go.php'); break; case 'delete_confirm': include('./includes/functions/delete.php'); break; } } ?> what happens.. there is a radio button next to each row, that is assigned to the ID of that row and when submitted it uses the case func to determin what to do with the submitted info. its a rather clean and easy way to do what you are wanting. 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.