Hi all,

I am making one application. When user will submit a form from frontend and it will go all value in database. After that i am showind this frontend form value in backend. In backend or admin section i am using two button one for submit and other for delete . Like if this information is useful then i will submit otherwise i will click on delete button.

But i want to make this application in some easy way. Let me explain whole thing.

[B]first record[/B]
---here will be info regarding form which have submitted from frontend form----------- Here will be checkbox for submit or delete
[B]second record[/B]
---here will be info regarding form which have submitted from frontend form------------ Here will be checkbox for submit or delete

( one records info and checkbox will come in a row )

and after all these records there will be two button one for submit and another for delete button
if i will click on submit button then records will be add in database and if i will click on delete button then it will delete from databse.

Like our mail we see in gmail or yahoo works . Like this.
Please help me how i can do this in PHP. I will be very thankful of him. Let me know if any further query.
Thanks
gagan

Recommended Answers

All 3 Replies

you need to group your checkboxes

<input type="checkbox" name="grp[]" value="1" />
<input type="checkbox" name="grp[]" value="2" />

Then you can use

foreach ($_POST["grp"] as $key => $value) {
  # delete/submit record with id $value
}

you can do that in three files *add file, *delete file, and you could also put that in a single one but it is complicated.

the delete file should contain the delete statements, of course you should have the selection process wherein your user will select first what record he wants to delete, let's say you ask for the id# of the record you want to delete, then you will select from your database the record having this id# then it will delete that whole record.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.