hsaenz12 Posted November 6, 2009 Share Posted November 6, 2009 I have this $p_number = $_POST['Req_number']; //which is an array of values from a form I need something like this $body = $prefix."\n".$name.' <'.$email.'>'."\r\n\r\n".stripslashes($body)."\r\n\r\n".stripslashes($p_number); $mail->setBody ( $body ); but $p_number returns "array" in the email body. How can I print the values of the array in the $body variable???? Link to comment https://forums.phpfreaks.com/topic/180581-solved-assign-array-values-to-a-variable/ Share on other sites More sharing options...
lemmin Posted November 6, 2009 Share Posted November 6, 2009 You have to iterate through the values: $body = $prefix."\n".$name.' <'.$email.'>'."\r\n\r\n".stripslashes($body)."\r\n\r\n"; foreach ($p_number as $n) $body .= stripslashes($n) . ","; Link to comment https://forums.phpfreaks.com/topic/180581-solved-assign-array-values-to-a-variable/#findComment-952707 Share on other sites More sharing options...
hsaenz12 Posted November 6, 2009 Author Share Posted November 6, 2009 Thank you Lemmin. What if i have this $p_number = $_POST['Req_number']; $p_value = $_POST['Req_value']; and want something like this foreach ($p_value as $v) foreach ($p_number as $n) $body .= stripslashes($n) .stripslashes($v) . ","; Link to comment https://forums.phpfreaks.com/topic/180581-solved-assign-array-values-to-a-variable/#findComment-952736 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.