# Completing two forms with 1 submit button



## Guitarlp (Jul 1, 2004)

I'm creating a single form that someone fills out... but once they click submit it automatically sends the information as two forms (so I can send the information to 2 different databases). I have it working so far but It's only sending information to 1 of the forms. The problem I'm having is populating the "hidden" information in the MailingList form with the information from the Discount form. Here is what I have:

*Enter your first name:*

*Enter your email:*

How can I populate the MailingList Name and emailaddress with the name and email from the Discount form?


----------



## Guitarlp (Jul 1, 2004)

Ok... I think I may have figured this out... but it's only submiting the Discount form... not the MailingList form (the second one). Is there something I need to change?

*Enter your first name:*

*Enter your email:*


----------



## bassetman (Jun 7, 2001)

Not sure, but is this what you are looking for?


```

```


----------



## oz_emb (Nov 28, 2004)

If you use PHP, past this whole thing into a file named test.php and try it out

If you do not use PHP, use just the top part and add your own routine for examining the value in the server-side language of your choice.

This script works by creating a new form element at submit time. The value of the text field in formOne is appended as a hidden field to formTwo.

The JavaScript has been tested with IE 6/Win and NN 7.

<?php

echo "POST data: 
\n";

// show all POST data in key, value pairs

foreach ($_POST as $key => $value)
{
echo "Key: ".$key."; Value: ".$value."
\n";
}

?>


----------

