Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    86
    Thanks
    5
    Thanked 1 Time in 1 Post

    onClick function running a PHP script, not opening a window

    I would like to have an onClick function that when the object (image that submits a form) is clicked on, it runs a PHP script as well as submitting the form. I can get it to work by opening a new window, but I don't want this to happen as it looks fairly spammy even when you use javascript to immediately close that window after the PHP script has done its bit.

    Cheers

    The Moose

  • #2
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Is there any reason not to run the code from the file where the form processing takes place?

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    86
    Thanks
    5
    Thanked 1 Time in 1 Post
    Yep!! I don't have access to the form processing script!

    Cheers

    The Moose

  • #4
    New Coder
    Join Date
    Jul 2008
    Posts
    86
    Thanks
    5
    Thanked 1 Time in 1 Post
    any ideas?!?

  • #5
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,480
    Thanks
    6
    Thanked 981 Times in 954 Posts
    Quote Originally Posted by the moose View Post
    I would like to have an onClick function that when the object (image that submits a form) is clicked on, it runs a PHP script as well as submitting the form. I can get it to work by opening a new window, but I don't want this to happen as it looks fairly spammy even when you use javascript to immediately close that window after the PHP script has done its bit.

    Cheers

    The Moose
    How about some AJAX kind of script that would run the function? If the script is on the same domain there shouldn’t be any problem, I suppose.

  • #6
    New Coder
    Join Date
    Jul 2008
    Posts
    86
    Thanks
    5
    Thanked 1 Time in 1 Post
    Quote Originally Posted by VIPStephan View Post
    How about some AJAX kind of script that would run the function? If the script is on the same domain there shouldn’t be any problem, I suppose.
    Am trying to do this right now,but can't see how to do this...

    Any ideas??

    Cheers

    The Moose


  •  

    Posting Permissions

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