SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    in_array problem can any1 help me please...

    Ok I looked on google and I have been up all night I am very close to working out my problem. I am having an issue with this in_array function. Here is my line of code:

    Line 35: if in_array($ShipState, $Zone1States))

    Here is my error:
    Wrong datatype for second argument in call to in_array in c:\apache\htdocs\trials\payment.php on line 35

    can anyone tell me why I can not check if the variable from a form is in the array?

    here is more of the code:

    $ShipState = $_POST[ShippingState];

    // check zone 1 states
    $Zone1States == explode(",", $options['Zone1']);

    //check ship address to zone 1 states
    if (in_array($ShipState, $Zone1States))<---line 35
    {
    $ZoneShipping = $_POST[ShippingPrice];
    echo 'User\'s City Found in Zone1';
    }

  2. #2
    SitePoint Evangelist hexburner's Avatar
    Join Date
    Jan 2007
    Location
    Belgium
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're comparing $Zone1States and explode(",", $options['Zone1']).
    Use one =
    PHP Code:
    $Zone1States explode(","$options['Zone1']); 
    FOR SALE: 1 set of morals, never used, will sell cheap

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hexburner View Post
    You're comparing $Zone1States and explode(",", $options['Zone1']).
    Use one =
    PHP Code:
    $Zone1States explode(","$options['Zone1']); 
    TY bery bery much!!!!
    It's nice to be important but it's more important to be nice!!!

    My New site: Downloads


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •