form problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Krista

    form problem

    Hi , hope u guys can help me out ...

    Can i do like that in php file?

    <form....> (doesnt work)
    <form....>
    ............ (doesnt work)
    </form>
    <form....> (work)
    ...............
    </form>
    ..............
    </form>
    when i do it like that i can only work in one form action.
    thanks,
    krista
  • Daniel Tryba

    #2
    Re: form problem

    Krista <ywan_ip@hotmai l.com> wrote:[color=blue]
    > Can i do like that in php file?
    >
    > <form....> (doesnt work)
    > <form....>
    > ............ (doesnt work)
    > </form>
    > <form....> (work)
    > ...............
    > </form>
    > ..............
    > </form>
    > when i do it like that i can only work in one form action.[/color]

    You can't nest forms, actions taken by the browser are irratic (most
    process the first form, at least konqueror processes last).

    BTW I don't see how this question is related to PHP! Looks like you are
    asking a clientside question IMHO.

    --

    Daniel Tryba

    Comment

    • Joshua Beall

      #3
      Re: form problem

      "Krista" <ywan_ip@hotmai l.com> wrote in message
      news:eb97c972.0 312231638.6dfd1 921@posting.goo gle.com...[color=blue]
      > Hi , hope u guys can help me out ...
      >
      > Can i do like that in php file?
      >
      > <form....> (doesnt work)
      > <form....>
      > ............ (doesnt work)
      > </form>
      > <form....> (work)
      > ...............
      > </form>
      > ..............
      > </form>
      > when i do it like that i can only work in one form action.
      > thanks,
      > krista[/color]

      I do not understand the question, what you are trying to do, or how PHP has
      anything to with it. Perhaps if you could post some of the actual code that
      you are having trouble with, or a link to an example page?


      Comment

      • Pedro Graca

        #4
        Re: form problem

        Krista wrote:[color=blue]
        ><form....> (doesnt work)
        > <form....>
        > ............ (doesnt work)
        > </form>
        > <form....> (work)
        > ...............
        > </form>
        > ..............
        ></form>
        > when i do it like that i can only work in one form action.[/color]


        You can't have a <form ...> inside another <form ...>.

        But you can have two different forms (with two different submit buttons)
        on the same page :)

        <form name="form1" action="process form.php" method="post">
        <input type="hidden" name="formname" value="form1"/>
        <input type="text" name="name"/>
        <input type="submit"/>
        </form>
        <form name="form2" action="process form.php" method="post">
        <input type="hidden" name="formname" value="form2"/>
        <input type="text" name="address"/>
        <input type="submit"/>
        </form>


        and your processform.php could be something like:

        <?php // processform.php
        if ($_SERVER['REQUEST_METHOD '] == 'POST') {
        // process form
        if (isset($_POST['formname'])) {
        if ($_POST['formname'] == 'form1') {
        // deal with form1
        // $_POST['name'] is (probably) ok
        // $_POST['address'] is not defined here
        } else {
        // assume form2 and deal with it
        // $_POST['name'] is not defined here
        // $_POST['address'] is (probably) ok
        }
        } else exit('Go hacking someplace else!');
        } else exit('You cannot GET (or HEAD, or ...) this page!');
        ?>
        --
        --= my mail box only accepts =--
        --= Content-Type: text/plain =--
        --= Size below 10001 bytes =--

        Comment

        Working...