1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

can you detect closing broswer and if submit was clicked?

Discussion in 'PHP' started by cl328, Jan 15, 2009.

  1. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #21
    you cant check if submit is already pressed because if they press submit, they wont be on that page anymore
     
    crath, Jan 16, 2009 IP
  2. cl328

    cl328 Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #22
    question:

    body onUnload="checkbutton(this);"

    i need to send the form object, how to do that?



    PS. good news --- i think i have a solution
     
    cl328, Jan 16, 2009 IP
  3. cl328

    cl328 Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #23
    you saying there is NOT a way to know if the submit button has been pressed, UNLESS you are on the next page?

    isn't the onunload event, the last thing that happens before page leaves -- wouldn't the button value be set at that point?
     
    cl328, Jan 16, 2009 IP
  4. cl328

    cl328 Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #24
    < body .... onunload="javascript:checkbutton(document.form1.elements["hid"].value);" >

    that does not work?
    i have a hidden fields: hid in the form, how can i send that?
     
    cl328, Jan 16, 2009 IP
  5. cl328

    cl328 Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #25
    in case anyone cares :)

    i solved my problem perfectly... with one new thought...

    page 1 - submits (data is saved to DB)
    then to page 2

    using the onunload="javascript:myfunctinoname();"
    i call an ajax script that calls a php script that updates the DB record to complete.

    so if visitor leaves (record gets completed)
    or if user submits page 2 (record gets completed AND same functionality exist--- which was to delete old record and insert new record with both pages of data)

    so, the new thought to solved the problem, i completed the record and didn't care about checking if the submit button was pressed or not.

    NOTE: i got rid of 2 records issue and the human problem is not a problem because the delete/insert happens back to back -- so no time delay.

    thanks for you help
    :)
     
    cl328, Jan 16, 2009 IP
  6. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #26
    Glad I could help.
     
    crath, Jan 16, 2009 IP