How can I set a cookie value which getting from the shortcode attributes .?
For example , in this shortcode [shortcode ids="12"][/shortcode] , I need to set these ids in a cookie. When I tried to use  setcookie ('ids', '12', time()+31536000, '/', 'localhost', '0');  I get the warning message 
Warning: Cannot modify header information - headers already sent by (output started at /var/www/wordpress_retail/wp-content/themes/twentythirteen/header.php:13).
What could be the issue?
I used this code inside the function custom_feilds  add_shortcode('shortocode', array(&$this, 'custom_feilds'));
 
     
    