close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Free Shipping Coupon Codes with Multiple Shipping Rules

Thread began 8/17/2010 12:52 pm by jgraber | Last modified 8/24/2010 11:01 am by jgraber | 1157 views | 10 replies

jgraber

gravarce and

Tried to reload the file, but with no success. I think I've found the culprit, but can't think of any work around. Here is the code:

<?php
if (!session_id()) session_start();
if((((isset($_POST["coupon"]))?$_POST["coupon"]:"") != "")) {
$_SESSION["CouponCode"] = "".((isset($_POST["coupon"]))?$_POST["coupon"]:"") ."";
$_SESSION["CouponCode2"] = "".((isset($_POST["coupon"]))?$_POST["coupon"]:"") ."";
}
?>



I believe it is because the 2 session values are both using the $_POST["coupon"] form input and so when a new code is entered it just overwrites the previous. To test I added a second coupon code form called 'coupon2' and used this code.

<?php
if (!session_id()) session_start();
if((((isset($_POST["coupon"]))?$_POST["coupon"]:"") != "")) {
$_SESSION["CouponCode"] = "".((isset($_POST["coupon"]))?$_POST["coupon"]:"") ."";
}
?>
<?php
if (!session_id()) session_start();
if((((isset($_POST["coupon2"]))?$_POST["coupon2"]:"") != "")) {
$_SESSION["CouponCode2"] = "".((isset($_POST["coupon2"]))?$_POST["coupon2"]:"") ."";
}
?>



This successfully added a second discount to the cart without overwriting the previous. Now I really don't want to have multiple coupon forms so I was trying to think of a way to have the $_POST variable to change its name dynamically with each time the submit button is pressed or use some sort of 'if' statement, but can't think of anything that would work off the top of my head. If anyone has done something like this before let me know. I am assuming javascript would have to be used.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...