Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Member ThePhoenix2006's Avatar
    Join Date
    Mar 2005
    Location
    Michigan
    Posts
    88
    Member #
    9431
    Hey everyone,

    I am new to this PHP stuff and I can't seem to figure out what I need to do to be able to have link or button to remove an individual entry in a list.

    EX: (Listing band members)

    Justin - Vocals REMOVE
    Steve - Bass REMOVE

    Can anyone help me out on this?

    Thanks in advance!
    "Make sure the juice is worth the squeeze" ~The Girl Next Door

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Hey.

    Before we can help, we need to know if each band member has a row to themselves?
    If they do, I would presume there is a column that has a band id of some sort, to group members of the same band together?

    Anyhow, all you would do is

    1) edit the while/do-while loop that outputs the names and what they do/play, you would a link (or a button). In that link you would include the band members id number as a querystring parameter, such as

    HTML Code:
    <a href="domain.com/deletemember.php?memid=1">link</a>
    Where one is the value from the database

    2: Create deletemember.php (or another aptly named file) and in that file you would

    1) check that $_GET['memid'] is set, is not empty, is numeric, and/or strip_tags it just incase.
    2: You can either just delete there and then, but normally what I do is create a form with the given paramemer (memid) as a hidden field and ask the user if they would like to confirm the deletion.

    If you do point 2, do not just have a confirmation link (GET method) as when a web crawler/spider finds your page, they will visit that page and "hit" that page, meaning you could lose some of your data.

    Good luck.

    * Edit:

    Here is some code to list the delete link for you. You would place this in your loop that extracts and displays the members.

    PHP Code:
    echo "<a href=\"delete.php?memid=" $row['id'] . "\">Delete</a><br />"
    $row['id'] - you may have to change that to match your id.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:45 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com