Forum Moderators: coopster

Message Too Old, No Replies

2 Different Contact Us Forms

How to use 2 different forms on one page

         

cjbnash

8:09 am on Aug 31, 2009 (gmt 0)

10+ Year Member



Hi there,

Thanks in advance for any help.

I have a page that has two forms on it(1 is a join our mailing list, the other is a full contact us with notes page)

They both call different php scripts, however it always to defaulting to the 1st one. Is there anything I can do to make sure it calls the correct one?

Thanks

ALKateb

8:38 am on Aug 31, 2009 (gmt 0)

10+ Year Member



are they two forms? i mean if u are submitting to different data to two different targets they should be two forms!

like this for instance

<form action = "first.php" method = "post">
<input name="text1" type="text" />
<input name="submit1" type="submit" />
</form>

<form action = "second.php" method = "post">
<input name="text2" type="text" />
<input name="submit2" type="submit" />
</form>

if u click the first button it will submit the first form to first.php and if u click the second it will submit the second form to second.php
i'm not sure i understood u .. can u explain more please?

rocknbil

5:01 pm on Aug 31, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard cjbnash,

however it always to defaulting to the 1st one.

Does your page validate [validator.w3.org]?

I will place a good bet that your forms are improperly nested or there are other page errors. Example:

<table>
<form>
<tr><td>.......</td></tr>
<tr><td>
<form>
.........
</form>
</td></tr>
</form>
</table>

The horror above is a form inside a form (invalid), improperly nested inside a table. Either will cause erratic behavior, and possibly only post to the "outer" form. Valid code would be something like

<table>
<tr><td>
<form>
.......
</form>
</td></tr>
<tr><td>
<form>
.........
</form>
</td></tr>
</table>

.... or with the form tags OUTSIDE the table. This is most likely not a PHP issue, it is a valid HTML issue.