Forum Moderators: coopster

Message Too Old, No Replies

Two "form actions" destination & one click submit

Transforming two actions in only one submit !

         

henry0

9:16 pm on Jul 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello
I did cut through the HTML showing only what matters
I cannnot figure how sending input from two separated
"form action" (update.php and update_2.php) using only one submit button
the only totally inelegant solution I found is having 2 buttons, sent the first set, go back and send the second one

I always have some unpleasant moments with forms :)

any input

thank you

regards

<form action ="update.php" method="post">
Enter Username (Writer):<input type="text"name="writer" value="<?php echo $writer;?>">
<br>
Enter Page (Code or Segment name):<input type="text"name="page" value="<?php echo $page;?>">

<br>
<input type="submit"></form>
</tr></td>

<!--// second set -->
<tr>
<td width="640" align="left" valign="top">
<form action ="update_2.php" method="post">
Enter Username (SAME as Username):<input type="text"name="username" value="<?php echo $username;?>">
<br>
Enter Password (Password):<input type="text"name="password" value="<?php echo $password;?>">
<br>
Enter First and Last Name (Full Name):<input type="text"name="full_name" value="<?php echo $full_name;?>">

Marcia

9:25 pm on Jul 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is that controlled by the HTML, or is it something that's configured and controlled from within the code of the PHP script? It sounds like more of a back end issue than on-page HTML.

henry0

9:59 pm on Jul 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



HEllo Marcia,
the form is simply HTML form
it only does send the $var input to the rest of the php script
so we can even forget all PHP coding
and rephrase my quest as:
how may I send to different sets of input to two different location (URL of the php files)
by only using one submit to do the whole work

as is it works but as I mentioned it requires to go back and click the second submit button
which does not sound correct!

thank you

tedster

2:01 am on Jul 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



After some talk with jatar_k, we've moved this question to the PHP Forum -- not because of the PHP you already are using, but because sending data two different places from one form will probably require server-side scripting. It's not a built-in cabability of HTML.

lorax

2:35 am on Jul 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The only possible thing I can think of is to use javascript and the onSubmit event such that the submit button would be used to submit one form and that <form> tag would have an onSubmit event in it that would call a function to submit the second form. You'll have to give the second form a name so you can call it. I haven't tried this but in theory I believe it would work.

Asandir

5:14 am on Jul 9, 2003 (gmt 0)

10+ Year Member



I'd say either go to one destination first, process and forward on with scripting, or if you can use a "get" based form, you could use javascript to spawn a new window on click....

vincevincevince

8:33 am on Jul 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



as tedster says... server side is the way to go

send the form output to one php file only - then either make that file handle both sets of data by merging your two existing scripts - or get it to forward the data on after use to the 2nd script.

henry0

11:36 am on Jul 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you all
I am not a JS accomplished person
althouogh it makes sense; I'll stick with PHP
that I am more familiar with
regards

Henry