Page Need to pass calculated value to redirect page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JCCDEVEL
    New Member
    • Jun 2007
    • 15

    Page Need to pass calculated value to redirect page

    Hi All,

    I'm trying to do the following:

    1) ON a php page, calculate fees based upon user entires. I'm calculating it in a javascript function and that is working well. However, I need to take that calculated amount and pass it to a new page on redirect. something like this:

    [PHP] <input type="hidden" name="redirect" value="http://www.pagename.co m/v3/payment_pg.php? FeeCalcTotal=" & chargetotal& " " >[/PHP]

    "chargetota l" is set as a hidden variable like this:

    [PHP]<input TYPE="hidden" NAME="chargetot al" value = "">[/PHP]

    and I am attempting to set it in my javascipt function like this:

    Code:
    FeeCalcTotal = (Witness1Fee  + Witness2Fee  + Witness3Fee  + Witness4Fee)* Discount;
     
    document.form1.chargetotal.value = FeeCalcTotal
    Two things are happening when the submit button is pressed. First, this happens:

    [PHP]<form name="form1" method="post" action="/cgi/formmail">[/PHP]

    Then, the redirect happens

    Am I doing this correctly? I'm used to doing this sort of thing on web pages that live on our own servers - this is for somebody's individual website.

    Thanks in advance for your help!

    Happy Friday!

    JCC
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    No PHP in sight! This thread belongs in the HTML/JavaScript forum. So I will move it there.

    moderator

    Comment

    • hsriat
      Recognized Expert Top Contributor
      • Jan 2008
      • 1653

      #3
      Originally posted by JCCDEVEL
      Hi All,

      I'm trying to do the following:

      1) ON a php page, calculate fees based upon user entires. I'm calculating it in a javascript function and that is working well. However, I need to take that calculated amount and pass it to a new page on redirect. something like this:

      [PHP] <input type="hidden" name="redirect" value="http://www.pagename.co m/v3/payment_pg.php? FeeCalcTotal=" & chargetotal& " " >[/PHP]

      "chargetota l" is set as a hidden variable like this:

      [PHP]<input TYPE="hidden" NAME="chargetot al" value = "">[/PHP]

      and I am attempting to set it in my javascipt function like this:

      Code:
      FeeCalcTotal = (Witness1Fee  + Witness2Fee  + Witness3Fee  + Witness4Fee)* Discount;
       
      document.form1.chargetotal.value = FeeCalcTotal
      Two things are happening when the submit button is pressed. First, this happens:

      [PHP]<form name="form1" method="post" action="/cgi/formmail">[/PHP]

      Then, the redirect happens

      Am I doing this correctly? I'm used to doing this sort of thing on web pages that live on our own servers - this is for somebody's individual website.

      Thanks in advance for your help!

      Happy Friday!

      JCC

      Are you redirecting to http://www.pagename.co m/v3/payment_pg.php? FeeCalcTotal=ch argetotal in the end of the PHP code of /cgi/formmail/index.php ?

      Comment

      • JCCDEVEL
        New Member
        • Jun 2007
        • 15

        #4
        Originally posted by hsriat
        Are you redirecting to http://www.pagename.co m/v3/payment_pg.php? FeeCalcTotal=ch argetotal in the end of the PHP code of /cgi/formmail/index.php ?
        Hi,
        This is the block that has all the form actions:

        Code:
                     
         <form name="form1" method="post" action="/cgi/formmail">
        <input type="hidden" name="required" value="AttyName, AttyStreet, AttyCity, AttyState, AttyPhone">
               <input type="hidden" name="missing_fields_redirect" value="http://www.website.com/v3/fail.php">
             		<input type="hidden" name="subject" value="PrivateSummons">
                        <input type="hidden" name="email" value="Email">
                        <input type="hidden" name="recipient" value="webform@website.com"/>
        		<input TYPE="hidden" NAME="chargetotal" value = "">
        
        		<input type="hidden" name="redirect" value="http://www.website.com/v3/payment_pg.php?FeeCalcTotal=" & fees& " " >
        So, things should happen when "Submit" happens, 1) a post to ="/cgi/formmail and then a redirect to payment_pg with the value passed to that page somehow

        Thanks!

        JCC

        Comment

        • hsriat
          Recognized Expert Top Contributor
          • Jan 2008
          • 1653

          #5
          Add this to the end of your PHP in cgi/formmail/
          [php]header("Locatio n: ".$_POST['redirect'].$_POST['chargetotal']);[/php]

          That is how much I could understand your problem.

          Comment

          • JCCDEVEL
            New Member
            • Jun 2007
            • 15

            #6
            Originally posted by hsriat
            Add this to the end of your PHP in cgi/formmail/
            [php]header("Locatio n: ".$_POST['redirect'].$_POST['chargetotal']);[/php]

            That is how much I could understand your problem.
            Thanks for your input. Forgive my struggle with this, but this is completely out of my comfort zone and am trying to help a friend. So, it should like this?:

            [PHP] <form name="form1" method="post" action="/cgi/formmail" header("Locatio n: ".$_POST['redirect'].$_POST['chargetotal']);
            >[/PHP]

            Then I assume I will need to add a "GET" to the payment page?

            Comment

            • hsriat
              Recognized Expert Top Contributor
              • Jan 2008
              • 1653

              #7
              Ok... Leave everything apart, tell me the whole story first, what you actually want to do.

              Comment

              • ronverdonk
                Recognized Expert Specialist
                • Jul 2006
                • 4259

                #8
                I'll try to recapitulate.

                You have a form that must be submitted (using POST) to "/cgi/formmail", passing the required values in hidden fields with a prescribed name.

                This formmail function gets the form with the hidden fields in its $_POST array. It will pprocess the values from the $_POST array and redirect them to the site of which the name is stored in hidden field 'redirect'.

                I guess that will work. The question is if the JavaScript calculated amount is correctly stored in the value of the hidden form field 'chargetotal'.

                Does that sum it up?

                Ronald
                Last edited by ronverdonk; Feb 22 '08, 05:34 PM. Reason: typo's

                Comment

                • JCCDEVEL
                  New Member
                  • Jun 2007
                  • 15

                  #9
                  Originally posted by hsriat
                  Ok... Leave everything apart, tell me the whole story first, what you actually want to do.
                  OK, we'll start over.....

                  This site is a place for a customer to enter certain information to request services. The services have fees associated with them and they are based upon location. So, I have a bunch of Javascript that grabs the inputted city values and ends up calculating one fee amount (this is working fine).

                  When the customer clicks submit, three things should happen:
                  1) javscript calculation is performed (working)
                  2) calculation is stored in a hidden variable (might be working)
                  3) there is a method post to /cgi/formmail
                  4) there is a redirect to payment_pg.php page. The javascript calculation amount needs to be carried over to this page somehow

                  So, I think i have 2 issues - a) assiging the calculated value to a variable and b) sending that variable to the next page

                  Hope this is a little clearer!

                  Comment

                  • JCCDEVEL
                    New Member
                    • Jun 2007
                    • 15

                    #10
                    Originally posted by ronverdonk
                    I'll try to recapitulate.

                    You have a form that must be submitted (using POST) to "/cgi/formmail", passing the required values in hidden fields with a prescribed name.

                    This formmail function gets the form with the hidden fields in its $_POST array. It will pprocess the values from the $_POST array and redirect them to the site of which the name is stored in hidden field 'redirect'.

                    I guess that will work. The question is if the JavaScript calculated amount is correctly stored in the value of the hidden form field 'chargetotal'.

                    Does that sum it up?

                    Ronald
                    Hi Ronald,

                    I'm skeptical about the 'chargetotal' field as well. I am assigning it in Javascript and used an 'alert" to see if it displayed the value. It does, but I'm not sure it works on the form itself

                    She actually wants the values posted to the payment_pg.php page

                    Thanks,

                    JCC

                    Comment

                    Working...