SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist pompopom's Avatar
    Join Date
    Feb 2004
    Location
    Huldenberg (Belgium)
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    multiple submit buttons and handling trough php

    hey everyone,

    does anyone know how I can make 2 forms on 1 page work?

    Let's say I have a webpage where the upper part is a utility, that the user can use to add things to a DB, the lower part is to delete things from a DB

    I tried to make two different forms: <form> my form with submit button</form> some more code <form> my form with submit button</form>

    But when I press the submit button to delete something it actually adds...
    when I create one single form with two different submitbuttons it only deletes and the add function stops working...

    any ideas??

    maybe this isn't a real php question but who knows...

    greetz,
    koen

  2. #2
    SitePoint Enthusiast mullen's Avatar
    Join Date
    Jul 2004
    Location
    Durham, UK
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make sure you give the submit buttons different "name" attributes. Then, in PHP, check to see if the button name is set, e.g. if (isset($add)) {

  3. #3
    SitePoint Evangelist pompopom's Avatar
    Join Date
    Feb 2004
    Location
    Huldenberg (Belgium)
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mullen
    Make sure you give the submit buttons different "name" attributes. Then, in PHP, check to see if the button name is set, e.g. if (isset($add)) {
    damn; why didn't I think of that...

    thx!!

    koen

  4. #4
    SitePoint Enthusiast mullen's Avatar
    Join Date
    Jul 2004
    Location
    Durham, UK
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem


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
  •