SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but I have a few problems.

    OK...I finally decided that for right now, it would be simpler to split the "insert new record" amd the "edit or delete" functions into seperate pages. So, I have the INSERT function working right. (they aren't really functions per se) I am however, having problems with the editing and deleting.

    The page (edit_delete.php3) starts by listing each event in a drop down list. Here are the pertinent parts:

    <form method="get" action="edit_delete.php3">
    <select name="event_listing">
    <option value="1">February 02 - The United Methodist Women of </option>

    So I am passing the id of the event to the processing page (which is the same page). This is where I need some advice. Should I give the option of checking a edit or delete radion button next to the drop dopwn list? Then based on that radio button I could branch into a edit or delete section of the script?

    I thought I could do something like this:

    <?php

    if ($submit) {
    branch to edit mode if edit is checked
    This section would fill form fields with the event selected (based on the ID from the drop down)
    } else {
    branch to delete mode of delete is checked
    This section would delete a row (based on the ID from the drop down)
    }

    I just can't get it working right. Could someone contribute?
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if ($submit) {
    branch to edit mode if edit is checked
    This section would fill form fields with the event selected (based on the ID from the drop down)
    } else {
    branch to delete mode of delete is checked
    This section would delete a row (based on the ID from the drop down)
    }
    First - use radio buttons over check boxes for a mutually excusive selection. That is, because the user must select "delete" OR "edit". However it would be illogical to select both "delete" AND "edit" which they could do if you provided check boxes. Now assuming that you store the value of the selected radio button in a variable $action...
    Code:
    if ($action == "delete") {
       // do the delete thing
    }
    if ($action == "edit") {
       // do the edit thing
    }
    
    or you could say
    
    if ($action == "delete") {
       //do the delete thing
    } else {
       // do the update thing by default
    }

  3. #3
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry...I meant radio buttons.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •