PHP Sending Email but body just got Array message -


i'm starting learn php , i'm trying send table via email. receiving email body says array. dont know go here, please help.

this how table being displayed, , send mail function in there well

    <form action="assign.php" method="post"><?php  if(is_array($result)){     echo '     <fieldset>         <legend>assign ticket</legend>         <div>changes affect updated rows only.</div>         <p></p>         <table width=auto cellpadding=1px cellspacing=0px border=1 align=center id=assign>              <thead>             <tr>';            // column comment db column header     foreach($result[0] $key => $val){         echo '<th align=center>'.$colcomments[$key].'</th>';         }     echo '             </tr>             </thead>             <tbody>';     foreach($result $row => $info){     echo '<tr>';     foreach($info $key => $val){     if($key=='id'){     echo '<td title="'.$colcomments[$key].'">'.$val.'.<input type="hidden" name="'.$key.'['.$info['id'].']" value="'.$val.'" id="rowid_'.$val.'" /></td>';          }     else {     echo '<td title="'.$colcomments[$key].'"><input type="text" name="'.$key.'['.$info['id'].']" value="'.$val.'" /></td>';          }          }     echo '</tr>';           }     echo '             </tbody>             </table>     </fieldset>';      if($result) {         $body = "<html>\n"             . "<head>\n"             . "</head>\n"             . "<body>\n"             . $result             . "</body>\n"             . "</html>\n";     //setting mail         $mail = new phpmailer();         if (email_use_smtp) {             // set mailer use smtp             $mail->issmtp();             //useful debugging, shows full smtp errors             $mail->smtpdebug = 1; // debugging: 1 = errors , messages, 2 = messages             // enable smtp authentication             $mail->smtpauth = email_smtp_auth;             // enable encryption, ssl/tls             if (defined(email_smtp_encryption)) {                 $mail->smtpsecure = email_smtp_encryption;             }             // specify host server             $mail->host = email_smtp_host;             $mail->username = email_smtp_username;             $mail->password = email_smtp_password;             $mail->port = email_smtp_port;         } else {             $mail->ismail();         }         $mail->from = email_from_address;         $mail->fromname = email_from_name;         $mail->addaddress('sample.test@domain.com');         $mail->subject = 'ticket assignment - ';         $mail->wordwrap = 100;         $mail->ishtml(true);         $mail->body = $body;         $mail->send();     } }  ?>    <fieldset>         <legend>select date</legend>         <div>select date , date to</div>         <p></p>         <input type="date" name="from" id="from" value="<?=$date['from']; ?>" />         <input type="date" name="to" id="to" value="<?=$date['to']; ?>" />         <div><input type="submit" value="submit" /></div>     </fieldset>     </form> 

here smtp debug result getting,

notice: array string conversion in c:\*\assign.php on line 260 

which refers this,

. "</body>\n" 

the issue in line above 260. $result array, can't concatenate other strings.

you can't use;

'<body>'.$result.'</body>' 

you can use;

'<body>'.json_encode($result).'</body>' 

(or other function converts array string)

i hope helps?


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -