simcoweb Posted October 13, 2006 Share Posted October 13, 2006 I get this error:[quote]Warning: mail() expects parameter 3 to be string, array given in /home2/wwwxxxx/public_html/forgot.php on line 24[/quote]from this code:[code]else {$row=mysql_fetch_array($r);$password=$row["password"];$email=$row["email"];$subject="your password";$header="from:admin@plateauprofessionals.com";$content="Hello. As per your request your password is ".$password;mail($email, $subject, $row, $header);print "<h2>Password Sent</h2><p><font class='bodytext'>An email containing the password has been sent to you.<BR>\n";}[/code]with line 24 being the one in red. [color=red]mail($email, $subject, $row, $header);[/color] Quote Link to comment Share on other sites More sharing options...
Orio Posted October 13, 2006 Share Posted October 13, 2006 Because the third parameter you gave is an array, $row. I think you meant to write $content instead of $row, so the line would look like this:mail($email, $subject, [color=red]$content[/color], $header);Orio. Quote Link to comment Share on other sites More sharing options...
craygo Posted October 13, 2006 Share Posted October 13, 2006 well it says exactly that. You used $row for one of your parameters. $row is an array from the database.mail function works like somail($to, $subject, $message, $headers)try this out[code]<?php$bcc = $email;$to = "";$subject = "Your Password";$headers = "From: admin@plateauprofessionals.com\r\n";$headers .= "BCC: $bcc\r\n";//leave the next 2 lines alone$headers .= "MIME-Version: 1.0\r\n";$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";$message="Hello. As per your request your password is ".$password;if(mail($to,$subject,$message,$headers)){echo "<p align=center class=returns>Password has been sent<br /></p>";} else {echo "<p align=center class=returns>Could not send E-Mail!<br /></p>";}?>[/code]Ray Quote Link to comment Share on other sites More sharing options...
simcoweb Posted October 13, 2006 Author Share Posted October 13, 2006 Ok, swapped that out and error went away. Thanks guys! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.