This is giving me an error on the if line? can someone please help, trying to do a coupon code for paypal.
[php]<?php
if (coupon=“half”);
{
You can mix and match HTML but you have to exit the php before you do it try this.
[php]<?php
if (coupon=“half”);
{
?>
Thank you but that did not work I have two errors in the code now
Your if statement is all messed up…
[php]if (coupon=“half”);
{[/php]
your setting the variable/function (i dont know which) equal coupon… and you have a semi colon after the statement which you don’t need.
single = sets something equal to
double == checks if they are equal.
Assuming you want a string variable its this.
[php] if( $coupon == “half”) {
[/php]
That works but does not do what I want it to do
I am using this as a paypal coupon since I can not advertise for less then MSRP of the products and paypal does not do coupons
I want it to work like this. If the coupon code is entered and correct I want it to go to the first button. If nothing is entered I would like it to go to the second button.
[code]Coupon Code
Ok, I get what you want to do but it is much more complicated that you seem to think it is. I have written the two files that you are going to need for your coupon field and posted the code for them here. The first file I have named paypal.php the second is couponchecker.php
paypal.php:
[php]
<?php } else { ?> "> Please Enter Your Coupon Code:
" /> <?php } ?>[/php]
codechecker.php
[php]<?php
if ($_REQUEST[“code”] == “half”) {
echo “<form target=“paypal” action=“https://www.paypal.com/cgi-bin/webscr” method=“post”>”;
echo “<input type=“hidden” name=“cmd” value=”_s-xclick">";
echo “<input type=“hidden” name=“hosted_button_id” value=“HWVCBQPA4D9K2”>”;
echo “<input type=“image” src=“https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif” border=“0” name=“submit” alt=“PayPal - The safer, easier way to pay online!”>”;
echo “<img alt=”" border=“0” src=“https://www.paypalobjects.com/en_US/i/scr/pixel.gif” width=“1” height=“1”>";
echo “”;
} elseif (empty($_REQUEST[“code”]) || ($_REQUEST[""] == null)) {
echo “<form target=“paypal” action=“https://www.paypal.com/cgi-bin/webscr” method=“post”>”;
echo “<input type=“hidden” name=“cmd” value=”_s-xclick">";
echo “<input type=“hidden” name=“hosted_button_id” value=“VAGSX4FWKS2Z2”>”;
echo “<input type=“image” src=“https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif” border=“0” name=“submit” alt=“PayPal - The safer, easier way to pay online!”>”;
echo “<img alt=”" border=“0” src=“https://www.paypalobjects.com/en_US/i/scr/pixel.gif” width=“1” height=“1”>";
echo “”;
}
?>[/php]
Everything always has to be more complicated then what you think it will be.
do I need to keep in of the original code?
[php]
Coupon Code
<?php if ($_coupon == "half") { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } else ; { echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } ?>[/php]
i included all your original code in mine… Just take a look at it. It is not a difficult concept
onkeyup preform this java the java gets another php file and returns a value from that file then your page displays that value
you had the right concept but you were trying to twist in a flathead screw with a phillips screwdriver…
replace your original code with Andrews codechecker.php one.
Codechecker only works if you use the JavaScript on the other file. Otherwise you will have to hit submit and reload the page to get the correct button to show. I am sure there is a way go get it all on to one php file I just don’t like doing it that way because I use this method for authentication.
Thank you guys you have been a lot of help, when i put the half in the coupon field and hit submit and then click the buy not it goes to the last button. that one that is supposed to be the original price one
Seriously all you had to do was upload a file called codechecker.php with that code i wrote to your directory with this index file and add the two sections to your index file I have done the latter for you here.
[php]
Not Normal Enterprises Not Normal Enterprises LLC • 71 East Geneva Street • Ocoee FL 34761 • /**/ /**/Site is under construction. Some pages may not work. Please check back in the future. Sorry for any inconvenience
if (!$_REQUEST){
?>
"> Coupon Code: <?php } else { ?> "> Coupon Code: " /> <?php } ?>[/php]
Thank you guys