Dear DP members, I am trying to create promo code for Paypal button, i am not able to check wheter the promo code enter is correct or wrong, Please guide where i am wrong in this script <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php include("buy_config.php"); ?> /// Here the user will enter promotional code to get discount in Product <FORM action="<? echo $path ?>#promo" method="post"> <br><font size = "<? echo $Fsize ?>"> <? echo $Ptxt ?> $<? echo $amount ?></font> <br> <br><font size = "2"> <? echo $Promo_txt ?></font> <br /> <input type="text" name="code" size="8" /> <INPUT type="submit" value="Recalculate"> </form> //// On pressing Recalculate The script will come here to check if the promo //// code entered is wrong it will display wrong code, else it will display ////correct code and will update the amount value in Paypal. <A name=promo></A> <table CELLPADDING=12 CELLSPACING=12><tr><td> <? $code = $_REQUEST['code']; if($code==$Promo_code) { echo ("<center><br><br><br><br><br><br><b>Correct Code</b><br><br><br><br><br><br></center>"); } else { echo ("<center><br><br><br><br><br><br><b>Wrong Code</b><br><br><br><br><br><br></center>"); } ?> PHP: Thanxs in advance, Best Regards, Ritesh Jain
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php include("buy_config.php"); ?> /// Here the user will enter promotional code to get discount in Product <FORM action="<? echo $path ?>#promo" method="post"> <br><font size = "<? echo $Fsize ?>"> <? echo $Ptxt ?> $<? echo $amount ?></font> <br> <br><font size = "2"> <? echo $Promo_txt ?></font> <br /> <input type="text" name="code" size="8" /> <INPUT type="submit" value="Recalculate"> </form> //// On pressing Recalculate The script will come here to check if the promo //// code entered is wrong it will display wrong code, else it will display ////correct code and will update the amount value in Paypal. <A name=promo></A> <table CELLPADDING=12 CELLSPACING=12><tr><td> <? $code = $_POST['code']; if($code==$Promo_code) { echo ("<center><br><br><br><br><br><br><b>Correct Code</b><br><br><br><br><br><br></center>"); } else { echo ("<center><br><br><br><br><br><br><b>Wrong Code</b><br><br><br><br><br><br></center>"); } ?> PHP:
Find : $code = $_REQUEST['code']; Replace with : $code = $_POST['code']; since you are using a form to submit data, you need to use $_POST, not $_REQUEST Hope it helps you