Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

maybe i'm starting to be blind but i have a problem that kill me, i have the next function and i get this error message:

Parse error: syntax error, unexpected '[' in /home/largo/public_html/dev/wp-content/plugins/email-key/email-key.php on line 28

in this line:

$to = components['recipient'];

i don't understand why.

function get_form_components($components) {
global $wpdb;
$table = $wpdb->prefix . "ebk";
$components['ebk_key'] = md5(microtime());
$sql = build_sql_insert($table,$components);
    if ($wpdb->query($sql) === FALSE) {
       //return FALSE;
    } else {
        $to = components['recipient'];
        $subject = "A message from the website " . get_bloginfo( 'name' );
        $message = "Hello,\n you getting this message because your email used in the contact form in this site: \n
        the message didn\'t sent yet and it\'s waiting in a Message queue, for the message actually will send please press the
        folowing link:\n " .$components['ebk_key'] . "\n Thanks you\n " . get_bloginfo( 'name' );
        @wp_email($to,$subject,$message);
    } 

$dummy_components = $components;
$dummy_components['recipient'] = '[email protected]';

return $dummy_components;
}
share|improve this question

closed as too localized by uınbɐɥs, Jocelyn, Ocramius, tereško, j0k Apr 30 at 16:11

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

5 Answers

change

$to = components['recipient']; 

to

$to = $components['recipient']; 

I guess.

share|improve this answer
oh my god, so so stupid thanks bkwint – Yehuda Hassine Aug 31 '12 at 9:36
np, can happen to anyone, just accept an answer to build up a bit more of a reputation for any of the correct ones. – bkwint Aug 31 '12 at 10:43

Change:

$to = components['recipient'];

To

$to = $components['recipient'];

This is why having an IDE with a built-in PHP parser will save you time.

share|improve this answer

Change $to = components['recipient']; to $to = $components['recipient'];

share|improve this answer

The line:

$to = components['recipient'];

to this:

$to = $components['recipient'];
share|improve this answer

You missed the $.

$to = $components['recipient'];
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.