468,306 Members | 1,178 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

Submit Two Forms w/ One Button??

Hey guys,

I have a php question. I have a php eccommerce site I am working on and have a particular problem.

Currently when a user presses one of my "Add To Kart" buttons it will add a product to the users cart without changing the current URL, which at that point would be something like "http:www.mydomain.com/index.php?mod=product&id_prd=5"

I have a shared SSL certificate on my server and want to redirect the user to a secure URL after they press the "Add To Kart" button, but before the product is submitted to the shopping cart; and in that order (but both after the same "Add To Kart" button is pushed). The secure redirect form displays the same unsecure URL: "http:www.mydomain.com/index.php?mod=product&id_prd=5" in the following secure manner: "https://servername.host.com/~username/mydomain/html/index.php?mod=product&id_prd=5"

The product is added to the cart by the following "Add To Cart" form:

<form name="chooseProperties" method="post" action="<?php
$KT_Temp = new AddToKartRegister();
$KT_Temp->registerField('id', $row_rsPrd['id_prd']);
$KT_Temp->registerField('name', $row_rsPrd['name_prd']);
$KT_Temp->registerField('price', $row_rsPrd['price_prd']);
$KT_Temp->registerField('quantity', 1);
$KT_Temp->registerField('weight', $row_rsPrd['weight_prd']);
echo $KT_Temp->getAddToKartLink('MXKart/addToKart.php') ?>">
<input name="AddToCart" type="submit" class="orangeButton" id="AddToCart" value="Add To Cart">


My "redirect" form has the following code:

<form name="redirect" method="post" action="<?php echo 'https://servername.host.com/~username/mydomain/html/index.php?'.$_SERVER['QUERY_STRING']; ?>">
<label>
<input type="submit" name="Submit" value="Submit">


What I would like to know is if there is some way to submit the "redirect" FIRST and then submit the "Add To Kart" form second, after the user hits the "Add To Kart" button?

Specifically is there any way to do this by calling functions and different pages in PHP without the use of Javascript? If not, what is the most efficient way to do this with the least amount of client side scripting as possible?

Any and all suggestions or help will be greatly appreciated.

Thanks
Apr 8 '07 #1
5 4055
ronverdonk
4,258 Expert 4TB
First suggestion is to read the Posting Guidelines and enclose your code within code or php tags.

moderator
Apr 8 '07 #2
Hey guys,

I have a php question. I have a php eccommerce site I am working on and have a particular problem.

Currently when a user presses one of my "Add To Kart" buttons it will add a product to the users cart without changing the current URL, which at that point would be something like "http:www.mydomain.com/index.php?mod=product&id_prd=5"

I have a shared SSL certificate on my server and want to redirect the user to a secure URL after they press the "Add To Kart" button, but before the product is submitted to the shopping cart; and in that order (but both after the same "Add To Kart" button is pushed). The secure redirect form displays the same unsecure URL: "http:www.mydomain.com/index.php?mod=product&id_prd=5" in the following secure manner: "https://servername.host.com/~username/mydomain/html/index.php?mod=product&id_prd=5"

The product is added to the cart by the following "Add To Cart" form:

Expand|Select|Wrap|Line Numbers
  1. <form name="chooseProperties" method="post" action="<?php 
  2. $KT_Temp = new AddToKartRegister();
  3. $KT_Temp->registerField('id', $row_rsPrd['id_prd']);
  4. $KT_Temp->registerField('name', $row_rsPrd['name_prd']);
  5. $KT_Temp->registerField('price', $row_rsPrd['price_prd']);
  6. $KT_Temp->registerField('quantity', 1);
  7. $KT_Temp->registerField('weight', $row_rsPrd['weight_prd']);
  8. echo $KT_Temp->getAddToKartLink('MXKart/addToKart.php') ?>">
  9. <input name="AddToCart" type="submit" class="orangeButton" id="AddToCart" value="Add To Cart">
My "redirect" form has the following code:

Expand|Select|Wrap|Line Numbers
  1. <form name="redirect" method="post" action="<?php echo 'https://servername.host.com/~username/mydomain/html/index.php?'.$_SERVER['QUERY_STRING']; ?>">
  2.    <label>
  3.      <input type="submit" name="Submit" value="Submit">
What I would like to know is if there is some way to submit the "redirect" FIRST and then submit the "Add To Kart" form second, after the user hits the "Add To Kart" button?

Specifically is there any way to do this by calling functions and different pages in PHP without the use of Javascript? If not, what is the most efficient way to do this with the least amount of client side scripting as possible?

Any and all suggestions or help will be greatly appreciated.

Thanks
Apr 9 '07 #3
First suggestion is to read the Posting Guidelines and enclose your code within code or php tags.

moderator
Sorry about that........I just added the code tags.........will my post still be seen by other people, or do I need to repost it????
Apr 9 '07 #4
ronverdonk
4,258 Expert 4TB
It is okay like this.

moderator
Apr 9 '07 #5
Motoma
3,237 Expert 2GB
Create a Javascript onLoad function to perform the second submit.
Apr 9 '07 #6

Post your reply

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

Similar topics

2 posts views Thread by Margaret Werdermann | last post: by
7 posts views Thread by TJS | last post: by
10 posts views Thread by ljlolel | last post: by
23 posts views Thread by mosesdinakaran | last post: by
6 posts views Thread by yawnmoth | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.