You are here: Re: 1 Form, 2 Actions? « PHP Programming Language « IT news, forums, messages
Re: 1 Form, 2 Actions?

Posted by Kimmo Laine on 03/30/06 16:27

"Mark" <Mark.Fenbers@noaa.gov> wrote in message
news:e0gjmt$gbg$1@news.nems.noaa.gov...
>I have a lengthy form (i.e., many inputs) on my form.php page. What's
>different about this form than many others I've created is that I want the
>user to have a choice of submitting this form data to one of two pages,
>choice1.php or choice2.php, both of which read $_POST data from the form.
>
> Obviously, a 'submit' button will send the user to the page specified by
> the form's 'action=' setting, so I would have to employ some sort of
> trick. But this is where I'm drawing a blank! What combination of PHP,
> Javascript, and HTML would do the trick?


Set the action to page3.php which has only the following:
<?php
if(isset($_POST['submit1']))
include('page1.php');
else if(isset($_POST['submit2']))
include('page2.php');
?>

And in the form you naturally have

<input type="submit" name="submit1" value="1">
<input type="submit" name="submit2" value="2">

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviφ
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация