473,467 Members | 1,596 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

multiple instance of same 'delete ' button

1 New Member
Hi everyone
newb, i am connecting to database then accessing a table and printing whole table on php page as table with "delete" button at the end of every row (so same delete button being printed many times).
want i want to do is if a user to be able to click on any delete button and that row data get deleted from database and reload the page with updated table.
i can print the table with data and "delete " button at the end but only first button works, but no data being passed so the delete query does not work ..
all the other buttons you can press but they do not respond
here is codes for printing form and table


Expand|Select|Wrap|Line Numbers
  1. <form action='viewcatalogues.php' method='post' enctype='multipart/form-data'>";
  2.  
  3.     while($data = mysql_fetch_assoc($getdata))
  4.     {
  5.  
  6.     echo "
  7.         <tr>
  8.             <td>".$data['cat_id']."</td>
  9.             <td>".$data['catalogue_name']."</td>
  10.             <td>".$data['file_name']."</td>
  11.             <td><a href='".$data['sale_setup']."'>".$data['sale_setup']."</a></td>
  12.             <td>".$data['arrival']."</td>
  13.             <td>".$data['copy_retail']."</td>
  14.             <td>".$data['image_cata']."</td>
  15.             <td>".$data['due']."</td>
  16.             <td>".$data['status']."</td>
  17.             <td><input type='submit' name='delete' value='del' ></td>
  18.         </tr>";
  19.     echo "
  20.     </form>";

please help
Apr 16 '10 #1
1 2111
nouras
15 New Member
you can send the id of row which you want to delete
like this ::
Expand|Select|Wrap|Line Numbers
  1. <?
  2. $query = $db->query("SELECT * FROM ".$base." ");
  3.  
  4.             if($db->num($query)){           
  5.  
  6.                 while ($result = $db->fetch($query)){
  7.  
  8.            echo '<tr>
  9.                         <td>'.$result[title_en].'</td>
  10.                         <td><a href="'.$url.'&act=del&id='.$result[id].'">Delete</a></td>';
  11.  
  12.  
  13.  
  14.                    echo'</tr>';
  15.                 }
  16.  
  17.     }
  18.  
  19. ?>
  20.  
Apr 17 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Richard Payne | last post by:
I am developing a web application that utilises multiple grids, panels, validation controls etc on the same page. I have added the appropriate code to pop up dialogs to confirm delete in...
0
by: Richard Payne | last post by:
I am developing a web application that utilises multiple grids, panels, validation controls etc on the same page. I have added the appropriate code to pop up dialogs to confirm delete in...
11
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
3
by: D. Shane Fowlkes | last post by:
Sorry for the length of this post. I have created a rather complex form which has a header/line item (parent and child records) structure. It's for an intranet. A screenshot can be seen here: ...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
4
by: ApexData | last post by:
I have a continuous form that has Allow- Add/Edit/Del set to False, so that the form is in View mode only. I have New/Edit/Del buttons in the form header. My New & Edit buttons work as a like. ...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
5
by: Neil | last post by:
"lyle" <lyle.fairfield@gmail.comwrote in message news:48c3dde7-07bd-48b8-91c3-e157b703f92b@f3g2000hsg.googlegroups.com... Question for you. I'm doing something similar, only, instead of opening...
3
by: nigelesquire | last post by:
Please help! I'm trying to clone and delete multiple rows with JavaScript. I need two delete buttons that work...! I only have one for now, but it's not working properly, the output count is...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.