Jump to content

Red100

New Members
  • Posts

    1
  • Joined

  • Last visited

Red100's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I am new to php and really need some help & advise. I am using a basic php script where a customer adds a promo code in a form which then redirects them to a special ordering page. We have a larger promotion coming up where I need to provide a much larger number of one-off codes and I didn't want to have to write hundreds of lines of code with these unique promo codes. I was wondering if there was a way to check if the promo code is correct against the codes in the MySQL database and then if correct redirect the customer to the correct URL? Thanks, any help will be welcome The simple code I have used so far is: <?php $errmsg = ""; if(empty($_POST['pode'])) { $errmsg = 'Enter promotional code'; include 'promoform.php'; } else { switch($_POST['pcode']) { case "code123": $redirectpage = 'http://www.website.com'; break; case "code456": $redirectpage = 'http://www.website.com'; } header("Location: $redirectpage"); } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.