PDA

View Full Version : Adding script to buttons



SirChick
06-23-2007, 12:05 AM
If i wanted to make a script run upon a click on a submit button where in the html properties of the submit button does it go to? Before/after the tag etc?

If i know this i can finally get my registration code to work

Watdaflip
06-23-2007, 06:49 PM
You need to create a form. The "action" attribute of the form is where the script should go that is executed when the form submits

SirChick
06-24-2007, 01:38 AM
so it goes directly after the action attribute in the code? i cant find action though

Watdaflip
06-24-2007, 04:29 AM
I don't use BV, so I don't know exactly where it is, or the exact name, but I know that you have to create the "form" element for the page. You can't just insert the text box's and a submit button, you have to insert the form field for the text and submit elements. That form element should have the option to change the action in the properties, or what not (right click, its somewhere in there).

SirChick
06-24-2007, 11:01 PM
Yeah i got that far, i just needed to put mysql code in to say what table and what database, but whas unsure on where to put the code logically in the page html.

navaldesign
06-25-2007, 05:27 PM
The procedure is simple:

As Watdaflip said, you create a form that collects the necessary info. Set the form action to be the script that will do the job. The info is submitted to the script, the database updated, and then the script redirects to a confirmation page. The confirmation page can be combined with the script. In that case, place the script in the Start of Page tag of the confirmation page, so if something goes wrong you can redirect the user to an error page.