Page 1 of 1
post the variables to two pages?????
Posted: Thu Feb 13, 2003 5:18 am
by hakiki_dolphin
Hi,
How can I post the variables to two php pages?
Ex: <form name="form" method="post" action='login1.php';'alogin1.php'>
.....
.....
<input type="submit" name="Submit" value="Tamam">
This code didn't work.
Posted: Thu Feb 13, 2003 5:19 am
by twigletmac
Why do you need to post the data to two pages?
Mac
Posted: Thu Feb 13, 2003 9:48 am
by superwormy
You can't using strait X/HTML, but you could use fsockopen or that PostToHost function I keep seeing around to make the second post to the second page.
http://www.php.net/fsockopen
http://www.faqts.com/knowledge_base/vie ... 039/fid/51
Posted: Thu Feb 13, 2003 10:04 am
by patrikG
You could also have "login1.php" auto-submit to "alogin1.php". Certainly not the most elegant solution, but it's definitely workable.
Posted: Thu Feb 13, 2003 11:18 am
by BigE
Yeah, your most likely going to have to use PHP to code that for you. HTML can only submit to one page at a time that I'm aware of.
Posted: Thu Feb 13, 2003 11:41 am
by patrikG
I don't know if that works, but you can bubble the onSubmit-event in Javascript.
If you look at the code below, you'll notice
a) document.form1.target - same as target in an <a href>. Thus you can easily use it to submit into invisible frames)
b) document.form1.action - which basically allows you to dynamically change the <form action="fileblabla.php"> tag.
Code: Select all
<script language=javascript>
function submitForm(path)
{
if (path=="whatever.php")
document.form1.target="_blank";
else document.form1.target="_self";
document.form1.action=path;
document.form1.submit();
}
</script>
<FORM name="form1" action="submit_to_wherever.php" method="post" onSubmit="return false;">
bla bla form bla bla
<input type=button onClick="submitForm('submit_form.php');" value='Submit Form'>