Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Submit button question

Options
  • 25-04-2007 2:50pm
    #1
    Registered Users Posts: 2,593 ✭✭✭


    Hi All

    I have a form that sends an email to a specific inbox containing the values in a series of input boxes. This is done through a PHP script once the user clicks on submit
    I also have a Javascript function to copy the values and save them elsewhere. Bot of these functions work great independently but now I am a bit lost as to how i can get both of them to work together ie when the submit button is pressed the vlaues get saved via the function call and then the php script is called as it is in the form action method.

    [PHP]
    <form method="post" action="http://xxxx.xxxx.xxxxx.com/Chases/frmml.php&quot; name="Chases">
    ..... input fields.....
    <input value="Submit" type="submit">
    [/PHP]

    Sorry if this is a silly question but I am stilll learning the ropes at Javascript and HTML and have done some googling but have had no success.. Hope somebody can point me in the right direction

    Thx


Comments

  • Registered Users Posts: 175 ✭✭zielarz


    Try to save the result of the function to a hidden input field. After the form is submitted you can access it from PHP level.
    The hidden input field can be declared as follows:
    <input type="hidden" name="result" />


  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    Where are you saving the values to? If you are using javascript to 'save' the values then unless you are saving them to an XML doc using the XML-javascript interface they will be lost when you go to another page (of course you could be saving them to a cookie in which case they will persist depending on the timeout registered to the cookie). As you are using php why not expand the php script to also save the values to a database or text file as appropriate. If you are saving them to a cookie you can access them on the php script through the cookie function set.

    -RD


  • Registered Users Posts: 2,593 ✭✭✭tommycahir


    Hi Guy's

    I actually played about with both the idea's but sorta by accident i stumbled across the solution. I added an onclick event trigger to the submit button and this then called the javascript function to save the data!

    so simple but yet something i hadnt thought of ..

    Thanks for the help


Advertisement