RroniDT Posted June 20, 2013 Share Posted June 20, 2013 (edited) Hi guys how are you today, well my question would be : Is there any possibility to make one common place for editing or deleting records from table which shows records from database(mysql).. what im trying to do is something like this on screenshot : http://i.imgur.com/zjsvor8.png (screen shot isn't from my project, but i'm trying to do it on my php project..) as u can see in screenshot there is a option buttons in the right corner for each record from database, so what am i trying to do is that when u click on one option button then u click edit or delete it must be take action of that particular record and edit or delete that !. To show my records on my php project i'm using this code : <?php require_once "db.php"; $result = mysql_query("select p_id, p_name, p_lastname, p_parentname, p_age from pacient"); while ($row = mysql_fetch_row($result) ) { echo "<TR><TH>ID<TH>Name<TH>Last Name<TH>Parent Name<TH>Age<TH>"; echo "<tr><td>"; echo("$row[0]"); echo("</td><td>"); echo("$row[1]"); echo("</td><td>"); echo("$row[2]"); echo("</td><td>"); echo("$row[3]"); echo("</td><td>"); echo("$row[4]"); echo("</td><td>"); ?> So guys how can i make on this code an option buttons for every record on right corner of them, and then 2 buttons, one for edit and one for delete and make them do an particular action ! (editing,or deleting depends on users choice..) Thanks i appreciate your help ! Edited June 20, 2013 by RroniDT Quote Link to comment https://forums.phpfreaks.com/topic/279389-how-to-editdelete-records-from-1-common-place/ Share on other sites More sharing options...
litebearer Posted June 20, 2013 Share Posted June 20, 2013 rough idea... new html table column ACTION each cell in the column will have the words EDIT DELETE the words will link to an edit or delete script. the link will pass the ID value of the data use GET in the edit or delete scripts. then take the appropriate action Quote Link to comment https://forums.phpfreaks.com/topic/279389-how-to-editdelete-records-from-1-common-place/#findComment-1437049 Share on other sites More sharing options...
RroniDT Posted June 20, 2013 Author Share Posted June 20, 2013 rough idea... new html table column ACTION each cell in the column will have the words EDIT DELETE the words will link to an edit or delete script. the link will pass the ID value of the data use GET in the edit or delete scripts. then take the appropriate action hmm if u think something like this i've already made it : http://i.imgur.com/u4QfbVS.png but im trying to do this stuff : http://i.imgur.com/zjsvor8.png can anybody help me pls :S Quote Link to comment https://forums.phpfreaks.com/topic/279389-how-to-editdelete-records-from-1-common-place/#findComment-1437058 Share on other sites More sharing options...
litebearer Posted June 20, 2013 Share Posted June 20, 2013 in image 2 are you trying to edit/delete more than 1 record at a time? If not, then my personal preference would be image 1. Quote Link to comment https://forums.phpfreaks.com/topic/279389-how-to-editdelete-records-from-1-common-place/#findComment-1437065 Share on other sites More sharing options...
RroniDT Posted June 20, 2013 Author Share Posted June 20, 2013 No im just trying to delete single records but with option buttons just like in second screenshot Quote Link to comment https://forums.phpfreaks.com/topic/279389-how-to-editdelete-records-from-1-common-place/#findComment-1437099 Share on other sites More sharing options...
RroniDT Posted June 22, 2013 Author Share Posted June 22, 2013 So there is no solution ???? Quote Link to comment https://forums.phpfreaks.com/topic/279389-how-to-editdelete-records-from-1-common-place/#findComment-1437346 Share on other sites More sharing options...
Christian F. Posted June 22, 2013 Share Posted June 22, 2013 There are plenty of solutions, but I'll give you a hint for the best one: Radio buttons. I would also suggest reading up more on HTML, especially forms, and how PHP receives/treats user input. Once you've got the prerequisite knowledge, solving this will be easy. Quote Link to comment https://forums.phpfreaks.com/topic/279389-how-to-editdelete-records-from-1-common-place/#findComment-1437368 Share on other sites More sharing options...
RroniDT Posted June 22, 2013 Author Share Posted June 22, 2013 There are plenty of solutions, but I'll give you a hint for the best one: Radio buttons. I would also suggest reading up more on HTML, especially forms, and how PHP receives/treats user input. Once you've got the prerequisite knowledge, solving this will be easy. so any concrete solution with radio buttons ? (the code).. Quote Link to comment https://forums.phpfreaks.com/topic/279389-how-to-editdelete-records-from-1-common-place/#findComment-1437436 Share on other sites More sharing options...
Christian F. Posted June 22, 2013 Share Posted June 22, 2013 We don't write the code for you, that's your job. We're here to give advice and help people learn, not work for free. I've given you what you need to be able to figure this one out on your own, all you need to do is to read, think, and try. Should you happen to get stuck on something, please feel free to post what you've done, explain what you're stuck on, and why. Then I'm sure someone will be along to help you get over that hurdle, or offer a tip on how to improve it so that you can avoid said problem. Good luck! Quote Link to comment https://forums.phpfreaks.com/topic/279389-how-to-editdelete-records-from-1-common-place/#findComment-1437438 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.