On 1/27/06, Philip Tellis <[EMAIL PROTECTED]> wrote:
> Sometime Today, F cobbled together some glyphs to say:
>
> > "<input type="text", name="firstname" size =" 34">" this creates a variable
> > "firstname" which can be collected for processing in a php script as
> > $_POST["firstname"] , but along with this say I also want to sent the text
> > "this is coming for form 1" how do I do that . I just can't generate a text
>
> assuming you have 2 (or 3 or n) forms on your page, set the action
> accordingly:
>
> <form method="get" action="myscript.php?form=1">
> ...
> </form>
>
> <form method="post" action="myscript.php?form=2">
> ...
> </form>
> ...
>
> in your script, check the value of $_GET['form'].

Assuming that you have a submit button in each of your forms, another
approach would be to use the same name attribute for the different
submit buttons, with different values for the value attribute in
different forms. Something like:

<html>
<title>forms</title>
<body>

<form method="POST">
<input type=submit value="Submit 1" name="op">
</form>

<form method="POST">
<input type=submit value="Submit 2" name="op">
</form>

<form method="POST">
<input type=submit value="Submit 3" name="op">
</form>

<?php

    if(isset($_POST["op"])) {
        echo "You submitted <b>" . $_POST["op"] . "</b>";
    }

?>

</body>
</html>


--
http://puggy.symonds.net/~natarajan

--
http://mm.glug-bom.org/mailman/listinfo/linuxers

Reply via email to