Как передать значение select в массив функции? HTML: <select name="category[]" multiple> <option>afaf</option> <option>fafsaf</option> </select> PHP: <? class Auth { function join() { print_r($this->r_category); } } $auth=new Auth(); $auth->r_category=$_POST['category']; $auth->join(); Проблема в том, что он выводит просто Array, больше ничего, что касаемо POST запроса, он корректно работает, так как без массива, все отлично.. Если подробнее, вот часть из полного кода: PHP: class Auth { public function join() { $users=$this->db->getAll("SELECT * FROM ?n WHERE ?n=?s OR ?n=?s", 'users', 'user', $this->r_login, 'email', $this->r_email); if( $this->r_terms!='on' ) $error="err_11"; if( $this->r_password!=$this->r_confirm ) $error='err_5'; if( empty($this->r_confirm) ) $error='err_4'; if( strlen($this->r_password)<6 ) $error="err_9"; if( empty($this->r_password) ) $error='err_3'; if( !filter_var($this->r_email, FILTER_VALIDATE_EMAIL) ) $error='err_8'; if( $this->r_email==$users[0][email] ) $error='err_7'; if( empty($this->r_email) ) $error='err_2'; if( $this->r_login==$users[0][user] ) $error='err_6'; if( empty($this->r_login) ) $error='err_1'; if( $_COOKIE['_rgs']!=$this->r_session ) $error='err_10'; if( $error ) $this->notification=$error; if( !$error ) $this->JoinInsertInDB(); $this->arr_notification='Echo: '.$this->r_category; } public function getArrNotification() { print_r($this->arr_notification); } } $auth->r_login=$_POST['login']; $auth->r_email=$_POST['email']; $auth->r_password=$_POST['password']; $auth->r_confirm=$_POST['confirm']; $auth->r_category=$_POST['category']; $auth->r_session=$_POST['session']; $auth->r_terms=$_POST['terms']; $auth->join(); $auth->getArrNotification();
проверил... вот мой код PHP: <form method="POST"> <select name="category[]" multiple> <option>afaf</option> <option>fafsaf</option> </select> <input type="submit" /> </form> <?php if(!empty($_POST['category'])){ $auth=new Auth(); $auth->r_category=$_POST['category']; $auth->join(); } class Auth { function join() { print_r($this->r_category); } } вот такое вот у меня вернуло Код (Text): Array ( [0] => afaf [1] => fafsaf ) вроде нет косяков..
@Алекс8, я нашел косяк в 19 строке: $this->arr_notification='Echo: '.$this->r_category; Дело в том, что я делал print_r('Echo:'.$this->r_category); и вся проблема в 'Echo'. Убрал, и сделал код таким образом: print_r($this->r_category); - вывел нормальный массив. Спасибо, что откликнулись.