Form move variables

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

    #1

    Form move variables

    Hello to all

    I have a form in a php script with some inputs.

    With this form I like te send a javascript variable to the
    next php script.
    Every Input are transmittet to the next value but the
    caddie value will not be send!
    I used the following command in the javascript area:
    document.form1. caddie.value = commande;
    I don't have a input on caddie!

    Many thanks in advance for your help.

    Regards

    Otto


    A view of the two scripts:



    Php script 1
    ************
    ..
    <FORM NAME="form1" onSubmit="retur n form_validator( this)"
    ACTION="order_f inal.php" METHOD=post>

    <SCRIPT language="JavaS cript"><!-- //script hider
    var commande = ""

    function form_validator( theForm)
    ...
    ...
    // send value commande with the form
    document.form1. caddie.value = commande;
    ...
    Return (true);
    }
    </SCRIPT>
    ...
    <INPUT TYPE=text NAME="email" VALUE="" SIZE=40>
    ...
    <INPUT TYPE=submit NAME=Submit VALUE="<?php echo
    $txt_send_order ?>" >
    ...
    </FONT>
    ...



    Php script 2:
    *************
    <?php
    $no_comm = date("ymjHis");

    // required variables
    require("config .php");

    $message ="IP: $REMOTE_ADDR Host: $REMOTE_HOST

    Commande No.: $no_comm

    $email
    $company
    $name
    $caddie

    Total $txt_currency: $total
    ";

    mail("$receipt, $email", "Re: Online Order", "$message",
    "From:$receipt" );
    ?>



  • HikksNotAtHome

    #2
    Re: Form move variables

    In article <VA.000001ae.00 2af272@freesurf .ch>, Otto Haldi <ohaldi@freesur f.ch>
    writes:
    [color=blue]
    >With this form I like te send a javascript variable to the
    >next php script.
    >Every Input are transmittet to the next value but the
    >caddie value will not be send!
    >I used the following command in the javascript area:
    >document.form1 .caddie.value = commande;
    >I don't have a input on caddie!
    >[/color]

    With the form code you gave, it should throw an error (javascript error) since
    caddie doesn't exist in the code you gave. Create an input named caddie and
    then let PHP retrieve its value.

    <input type="text" name="caddie" />

    And Return should be return, its case-sensitive (at the end of your js
    function)
    --
    Randy

    Comment

    • Otto Haldi

      #3
      Re: Form move variables

      Hello Randy,

      Many thanks four your quick answer.
      [color=blue]
      > With the form code you gave, it should throw an error (javascript error) since
      > caddie doesn't exist in the code you gave. Create an input named caddie and
      > then let PHP retrieve its value.
      >
      > <input type="text" name="caddie" />
      >
      > And Return should be return, its case-sensitive (at the end of your js
      > function)
      >[/color]

      I did exactly what you told me, but still not work!

      I also have tried this solution before.
      But I don't need to see this input field on the form!..


      Regards

      Otto

      PS: To see the whole php script, I can send you a copy if you like to help me
      more!



      Comment

      • HikksNotAtHome

        #4
        Re: Form move variables

        In article <VA.000001af.00 2e154d@freesurf .ch>, Otto Haldi <ohaldi@freesur f.ch>
        writes:
        [color=blue]
        >Hello Randy,
        >
        >Many thanks four your quick answer.
        >[color=green]
        >> With the form code you gave, it should throw an error (javascript error)[/color]
        >since[color=green]
        >> caddie doesn't exist in the code you gave. Create an input named caddie and
        >> then let PHP retrieve its value.
        >>
        >> <input type="text" name="caddie" />
        >>
        >> And Return should be return, its case-sensitive (at the end of your js
        >> function)
        >>[/color]
        >
        >I did exactly what you told me, but still not work![/color]

        Post a URL to a sample page.
        [color=blue]
        >I also have tried this solution before.
        >But I don't need to see this input field on the form!..[/color]

        Then make it a hidden input <input type="hidden" name="caddie".. ..../>

        --
        Randy

        Comment

        • Otto Haldi

          #5
          Re: Form move variables

          Hello Randy,

          Many thanks for your help. Now every think work well I find out my mistake!

          Regards and happy new year

          Otto


          [color=blue]
          >
          > In article <VA.000001af.00 2e154d@freesurf .ch>, Otto Haldi <ohaldi@freesur f.ch>
          > writes:
          >[color=green]
          > >Hello Randy,
          > >
          > >Many thanks four your quick answer.
          > >[color=darkred]
          > >> With the form code you gave, it should throw an error (javascript error)[/color]
          > >since[color=darkred]
          > >> caddie doesn't exist in the code you gave. Create an input named caddie and
          > >> then let PHP retrieve its value.
          > >>
          > >> <input type="text" name="caddie" />
          > >>
          > >> And Return should be return, its case-sensitive (at the end of your js
          > >> function)
          > >>[/color]
          > >
          > >I did exactly what you told me, but still not work![/color]
          >
          > Post a URL to a sample page.
          >[color=green]
          > >I also have tried this solution before.
          > >But I don't need to see this input field on the form!..[/color]
          >
          > Then make it a hidden input <input type="hidden" name="caddie".. ..../>
          >
          > --
          > Randy
          >[/color]


          Comment

          Working...