php - HTML Form send to different address based on text response -


i have form on site coupon codes using paypal. how can make when enter coupon code, brings them different part of site?

i.e. enter '10offbook', hit submit brings u books.php if enter '10offmagazine, hit submit brings magazine.php

  <form action="index.php" method="post">     <input type="text" name="couponcode"  placeholder="coupon code">     <input type="submit" name="submitcouponcode" value="apply coupon"> </form> 

on index.php, @ top, check value of coupon code entered, redirect different pages depending on value of coupon code.

if (isset($_post['submitcouponcode'])) {     $coupon = $_post['couponcode'];     if ($coupon == '10offbook') {         header('location: books.php');         exit;     } else if ($coupon == '10offmagazine') {         header('location: magazine.php');         exit;     } } 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -