www.webdeveloper.com
Results 1 to 14 of 14

Thread: if control for array

Threaded View

  1. #1
    Join Date
    Oct 2012
    Location
    istanbul
    Posts
    61

    if control for array

    Hello,

    array post
    Sample:
    form
    Code:
      
      <select size="8" name="day_of_week[]" id="day_of_week" multiple>  
    		<option value="-1" selected="selected">*</option>
    		<option value="0">Sunday</option>
    		<option value="1">Monday</option>
    		<option value="2">Tuesday</option>
    		<option value="3">Wednesday</option>
    		<option value="4">Thursday</option>
    		<option value="5">Friday</option>
    		<option value="6">Saturday</option>		
      </select>
    if(is_array($_POST['day_of_week']) && in_array(GOING TO HAPPEN HERE?, $_POST['day_of_week'])){
    echo "Selected day(s) of week";
    }
    PHP Code:
    if(is_array($_POST['day_of_week']) && in_array(GOING TO HAPPEN HERE?, $_POST['day_of_week'])){
    echo 
    "Selected day(s) of week";
    }


    // this is okay
    if(is_array($_POST['day_of_week']) && in_array('-1'$_POST['day_of_week'])){
    echo 
    "Disabled day(s) of week";

    Thanks
    Last edited by Adem; 09-14-2013 at 09:31 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles