#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0

    Please help convert into array


    PHP Code:
    <?php 
    if (($_POST['couponcode'] == "10off") && ($_POST['date'] !== "10/03/12" )) {
    echo 
    "The 10% coupon must be redeemed by Wednesday October 10, 2012. Please go back and choose an allowed date.";
    die;
    }
    ?>
    I need to add 10/03/12, 10/04/12, 10/05/12, 10/06/12, 10/07/12, 10/08/12, 10/09/12, 10/10/12 to an array

    and then check if coupon code = 10off and $_POST['date'] = one of the dates above.

    I know I need to convert it into an array but I can't figure out how even after researching.

    Can someone please help me out with this?

    Thank you for the help.
  2. #2
  3. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,749
    Rep Power
    9397
    Is the coupon going to be valid on the 14th of this month? How about in November? Next year?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0
    Should only be good until october 10 2012
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0
    So basically, if the "date" post is between today and October 10, 2012 ... continue on but if not then die;
  8. #5
  9. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,749
    Rep Power
    9397
    Originally Posted by activetech84
    So basically, if the "date" post is between today and October 10, 2012 ... continue on but if not then die;
    Or more simply "if it's after October 10, 2012".

    But before I go to the easy solution, why are you getting the date from $_POST? Don't you want to use today's date?
    [edit] I may have misread a bit but still the underlying issue stands: can't someone just enter whatever valid date they want and get access?
    Last edited by requinix; October 3rd, 2012 at 05:51 PM.
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    4
    Rep Power
    0
    this is used for appointments. on the previous step the user chooses a date for the appointment and uses the coupon to get a discount but it must be scheduled on an allowed date.
  12. #7
  13. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,749
    Rep Power
    9397
    I actually just realized that there are, in fact, three different dates in play. Right? I still think you can just go with a "if it's before October 10" (because they can't make an appointment in the past).

    But anyway no, then, they can't put in arbitrary dates. You can compare dates really easily if you convert them into YYYY/MM/DD format (because MM/DD/YY doesn't work). For example,
    PHP Code:
    if (date("Y/m/d") > "2012/10/13") { // if today is after Oct 13th 
  14. #8
  15. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    8
    Rep Power
    0

    Please help convert into array


    Thanks for joining with me and also fine this forum.Really nice foru thanks for share this...

IMN logo majestic logo threadwatch logo seochat tools logo