Jump to content

how to edit,delete records from 1 common place ?


RroniDT

Recommended Posts

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 by RroniDT
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)..

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.