Form Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave Mennenoh

    Form Question

    I have a form being filled in dynamically using PHP. It's working except
    I've run into an issue with the submit. I have a Select component (drop down
    box) that has an onchange="this. form.submit()" so that users can simply pick
    the item to be edited. Furtner down there's a standard submit button... How
    can I differentiate between the two submits?
    If they pick an item from the dropdown I just want to fill in the form with
    the data selected from the database for that record. If they hit the submit
    button, I want to post the form and save that data into the database.
    Seems like it should be an easy one, but I'm just missing it.

    thanks


    --
    Dave -
    Adobe Community Expert




  • Sjoerd

    #2
    Re: Form Question


    Dave Mennenoh wrote:[color=blue]
    > How can I differentiate between the two submits?[/color]

    <input type="submit" name="foo" value="bar">
    Clicking this button will post the form like there was a input field
    with name foo and value bar. Look for $_POST['foo']. If it exists, the
    button is clicked.


    Another option is to use javascript to fill a hidden field. Something
    like this:
    <input type="hidden" name="TypeOfSub mit" id="TypeOfSubmi t">
    <input type="submit"
    onClick="getEle mentById('TypeO fSubmit').value ='1'">
    <input type="submit"
    onClick="getEle mentById('TypeO fSubmit').value ='0'">

    Comment

    • Dave Mennenoh

      #3
      Re: Form Question

      >><input type="submit" name="foo" value="bar">

      Thanks! I knew it was a simple one.

      --
      Dave -
      Adobe Community Expert




      Comment

      Working...