PDA

View Full Version : letting the user trigger a subroutine


zenweezil
05-21-2003, 11:19 PM
I have an extensive cgi that allows the user to fill out a form and post the contents to the site, but I want to include an in-between step that lets them preview what they have filled in and then let them trigger the next subroutine that posts the material (writes it to the database.)

I haven't been able to use a submit button because it conflist withthe original form. Is there a way to have a button that the user can click to trigger another subroutine within the same cgi?

ACJavascript
05-25-2003, 05:50 PM
one way you could accomplish this is this.

For the first form, were the user initialy places there detials put a hidden form named ID

examle: <input type="hidden" name="ID" value="1">

In the script put on the very top before anything,, but below your form parser

if($FORM{'ID'}==1){
##Your sub routine
&DoThis;
exit;
}

Now that will send them so that they can preview there post.
On that page put another hidden form like this

<input type="hidden" name="ID" value="2">

then in the script do this

if($FORM{'ID'}==2){
##Post subroutine
&DoTHis;
exit;
}

that subroutine then sends them to post the data.

Happy Scripting :D:D