damion Posted November 15, 2014 Share Posted November 15, 2014 I have a function that is supposed to find the email address of the user that's logged in my application. going by their ID: function getUserEmail($userID){ $sqll="SELECT id,email FROM users WHERE id='".$userID."'"; $result1=mysql_query($sqll); $row11=mysql_fetch_assoc($result1); $processor=$row11["email"]; return $processor; } What I'm trying to do is incorporate that into sending a simple email to the person that's logged in after they submit a file. But the email is not being sent and I'm getting this message: Warning: mail() expects parameter 1 to be string, array given Here is what I have for sending the email : $sendto = getUserInfo($_REQUEST[1][email]); $subject = "File recieved"; $message = "Hello " . getUser($_REQUEST["user"]) . ". you successfully submitted: $title"; mail($sendto, $subject, $message); How do I extract just the email address to prevent giving the array? Quote Link to comment https://forums.phpfreaks.com/topic/292482-trying-to-extract-an-email-address-from-an-array-for-mail/ Share on other sites More sharing options...
sKunKbad Posted November 15, 2014 Share Posted November 15, 2014 In your first code your function name is getUserEmail, but that function is never called in the second code. We might need more info to help you solve this. Have you tried debugging the code, looking at the values of the variables at certain places? You might try FirePHP for Firefox or FirePHP for Chrome. (or perhaps ChromePHP). These tools will help you debug and make your job super easy. Quote Link to comment https://forums.phpfreaks.com/topic/292482-trying-to-extract-an-email-address-from-an-array-for-mail/#findComment-1496658 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.