Web Hosting Talk







View Full Version : one form, sent two places


compjab
04-25-2006, 06:32 PM
I have a form that takes a users name, address, telephone number, username, and password

I need the name, adresss, and phone number to submit to one script

I need the username and password to submit to another script

Any ideas


PS the scripts are PHP

PlanetWebHost
04-25-2006, 07:04 PM
well.. the easiest way to put another form on your thank you page, and stock the user/pass into hidden fields, then have JavaScript autosubmit the form.

You could also do this with curl, but that's a bit harder.

Vdevelopers
04-25-2006, 07:07 PM
Or you can submit it to an IFRAME first, then when that page is done loading, have it submit the form in the main page. Though this is a little more complicated.

compjab
04-25-2006, 07:36 PM
How exactly would the Javascript idea work?

PlanetWebHost
04-25-2006, 07:47 PM
How exactly would the Javascript idea work?

something like...

<?
$res = mysql_query("INSERT INTO USERS.... ");
?>
<body onLoad="document.login.submit();">
<form name="login" action="login.php" method="post">
<input type="hidden" name="username" value="<? echo $_POST['username']; ?>">
<input type="hidden" name="password" value="<? echo $_POST['password']; ?>">
</form>