473,413 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

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.com/v3/payment_pg.php?FeeCalcTotal=" & chargetotal& " " >[/PHP]

"chargetotal" is set as a hidden variable like this:

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

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

Expand|Select|Wrap|Line Numbers
  1. FeeCalcTotal = (Witness1Fee  + Witness2Fee  + Witness3Fee  + Witness4Fee)* Discount;
  2.  
  3. 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
Feb 22 '08 #1
9 2562
ronverdonk
4,258 Expert 4TB
No PHP in sight! This thread belongs in the HTML/JavaScript forum. So I will move it there.

moderator
Feb 22 '08 #2
hsriat
1,654 Expert 1GB
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.com/v3/payment_pg.php?FeeCalcTotal=" & chargetotal& " " >[/PHP]

"chargetotal" is set as a hidden variable like this:

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

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

Expand|Select|Wrap|Line Numbers
  1. FeeCalcTotal = (Witness1Fee  + Witness2Fee  + Witness3Fee  + Witness4Fee)* Discount;
  2.  
  3. 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.com/v3/payment_pg.php?FeeCalcTotal=chargetotal in the end of the PHP code of /cgi/formmail/index.php ?
Feb 22 '08 #3
Are you redirecting to http://www.pagename.com/v3/payment_pg.php?FeeCalcTotal=chargetotal in the end of the PHP code of /cgi/formmail/index.php ?
Hi,
This is the block that has all the form actions:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  <form name="form1" method="post" action="/cgi/formmail">
  3. <input type="hidden" name="required" value="AttyName, AttyStreet, AttyCity, AttyState, AttyPhone">
  4.        <input type="hidden" name="missing_fields_redirect" value="http://www.website.com/v3/fail.php">
  5.              <input type="hidden" name="subject" value="PrivateSummons">
  6.                 <input type="hidden" name="email" value="Email">
  7.                 <input type="hidden" name="recipient" value="webform@website.com"/>
  8.         <input TYPE="hidden" NAME="chargetotal" value = "">
  9.  
  10.         <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
Feb 22 '08 #4
hsriat
1,654 Expert 1GB
Add this to the end of your PHP in cgi/formmail/
[php]header("Location: ".$_POST['redirect'].$_POST['chargetotal']);[/php]

That is how much I could understand your problem.
Feb 22 '08 #5
Add this to the end of your PHP in cgi/formmail/
[php]header("Location: ".$_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("Location: ".$_POST['redirect'].$_POST['chargetotal']);
>[/PHP]

Then I assume I will need to add a "GET" to the payment page?
Feb 22 '08 #6
hsriat
1,654 Expert 1GB
Ok... Leave everything apart, tell me the whole story first, what you actually want to do.
Feb 22 '08 #7
ronverdonk
4,258 Expert 4TB
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
Feb 22 '08 #8
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!
Feb 22 '08 #9
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
Feb 22 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: wk6pack | last post by:
Hi, I have a problem and not quite how to go about solving it. I have a form written in asp. I wish to submit the form and have the server return back to the same page without actually...
4
by: viktor | last post by:
Hi , I have a small problem.How can I pass value from form thru a few pages. I try with hidden field but my second page just validate and redirect to other one and when I use...
9
by: Paul | last post by:
What I am trying to do is as follows. I have a page with 3 links,that direct the user to 3 different pages when selected after login. So all link selections will first direct the user to a login...
2
by: macyp | last post by:
I have to pass values from one aspx page to another. The controls I have in the first page are: a textbox, 3 drop down lists, and 2 check boxes, and a submit button. It is a search page, and the...
3
by: Shapper | last post by:
Hello, I am working on an ASP.NET/VB web site. I have several links including menu links. Considerer a want to load a page named page.aspx. I can do it using javascript. Or using this code:...
6
by: Coleen | last post by:
Hi all :-) I need to redirect to multiple pages on click of a transmit button, without redisplaying each page. This redirection is to capture session variables that are created on each page and...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
4
by: antonyliu2002 | last post by:
Let me try to make clear what my concern is. I think it is a pretty interesting one, which I think of while I am developing my web application. I have an authenticated/authorized web...
8
by: m1post | last post by:
Hi, I'm very much a novice, and wondered if someone could help. I'll try to be as specific as possible, but don't waant you to have to read too much. I have 2 pages in the sequence. 1st allows...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.