473,386 Members | 1,693 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,386 software developers and data experts.

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 4233
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

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

Similar topics

4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
4
by: Sarah | last post by:
Hi all. I have a form, and several text and image links on it that should submit the form with different actions. I prepared a simple page with just the code that's not working. PROBLEM:...
2
by: Margaret Werdermann | last post by:
Hi all: I'm having a nasty time with a particularly difficult piece of code and was hoping someone might be able to help me. I have a FormMail form that originally worked perfectly. Then, I...
7
by: TJS | last post by:
what is wrong here, the submit will only post page back to itself instead of specifed action <SCRIPT language="Javascript"> function Submit_Form(){ document.Form1.Action="cart.asp";...
6
by: HD | last post by:
Hi. I have an asp page with radio buttons and a combobox... when the user clicks a radio button, I want the form to submit so I can execute the ASP code in order to change the list shown in the...
6
by: milkyway | last post by:
Hello there, I have the following code (written in Javascript) for posting of a form on the client side: .... var f2 = document.forms; f2.method = "post"; f2.submit();
10
by: ljlolel | last post by:
So.. I have a form that submits to an ASP.net site made in C-sharp. The ASP site is not mine, i do not have the server side code. When I submit from my form by pressing the Submit button, I get...
23
by: mosesdinakaran | last post by:
Hi All, I need a small clarification in submitting the forms, Ur suggestions please. In a page I have two form and also two submit butons. (ie)
6
by: yawnmoth | last post by:
I'm trying to write a so-called bookmarklet for a specific web app and am having some difficulty. One of the names of a specific forms inputs is submit. As such, doing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.