Web Analytics Made Easy -
StatCounter As like we delete mail from our mailbox - CodingForum


No announcement yet.

As like we delete mail from our mailbox

  • Filter
  • Time
  • Show
Clear All
new posts

  • As like we delete mail from our mailbox

    Hi everyone,

    I am working on a website admin section. In which i have information like our mail in our mailbox.Let me explain:-

    As we can delete more than one mail from our mailbox after selecting mails with checkboxes and then we click on delete all button.Then all mail have gone deleted.

    As such type of application i want to develope in PHP.

    In which all records are shown with each and every checkboxes. After selecting checkboxes and clicking on delete all button . All selected records should be deleted.

    How i can do this in PHP. Please help me. It is very urgent for my client.

    Last edited by gagan; Apr 9, 2009, 09:52 AM.

  • #2
    This is going to be sort of hard to explain ... but I think this is the direction to go.

    And this is a very generalized discussion ... not sure of anything you are using, like MySQL?

    When you display your list of items, you add a checkbox to each one along with
    a unique ID number (or some type of numbering scheme), like this:

    <input type=checkbox name="deleteMessage[]" value=3>
    <input type=checkbox name="deleteMessage[]" value=4>
    <input type=checkbox name="deleteMessage[]" value=5>
    <input type=checkbox name="deleteMessage[]" value=6>

    The "check all" or "uncheck all" is done using Javascripting ...

    <script language="javascript" type="text/javascript">
    function deleteMail(selection) {
      for (i = 0; i < document.forms[0].elements.length; i++) {
          if (selection == "all") {
              document.forms[0].elements[i].checked = true
          else {
              document.forms[0].elements[i].checked = false
    // -->
    stuff here
    <input type=button class=button value="Select all" onClick="deleteMail('all')">
    <input type=button class=button value="Deselect all" onClick="deleteMail('none')">
    <input type=submit class=button name=delete_mails value="Delete">
    When you process the form, you will have an array of those checkbox items
    and only the ones with a value will have the value assigned. You loop through
    that array and delete from your database, based off of the value.

    This is just really hard to explain because we don't have enough information from you.


    • #3
      Thanks for help,
      But i am making this application using database MYSQL . so pls help me how i can do this with the help of database .Because all these products which i want to delete them are fetched from database.

      Please help me . How i can do this.


      • #4
        Start out by first dealing with the display of items.

        For each line you display (from your MySQL database), add a checkbox
        with the ID (record) number of each line within the checkbox value.

        Example, the value of this checkbox is 321 ... that's the record number of that MySQL row.

        <input type=checkbox name="deleteRecord[]" value=321>

        As you display each record, put a checkbox in front of each one ...
        all have the same name.

        Let us know when you have that part.