Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

Array in email

the mail() function

Moderators: macek, egami, gesf

Array in email

Postby numb00000nuts » Sun Jun 12, 2011 4:59 am

Hi,

I am new to PHP as I am sure you will see.

I have an array that when displayed on the page is perfect. I then need to send the same information to my email script which is in table format. Everything works fine in the email apart from the array.

This is the code that takes the 5 element array and removes the empty elements and echo's the remaining elements:

$var_selected=array($var1,$var2,$var3,$var4,$var5);
$cleaned = array_filter($var_selected, 'strlen');
foreach($cleaned as $show_vars)
{
echo ($show_vars . "<br/>");
}

As I say this works fine but in the email it does not work:

<?php
<table width='590' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='103' bgcolor='#00AFF0'>td>
<td width='320' bgcolor='#00AFF0'><h2>test Email</h2></td>
<td width='167' bgcolor='#00AFF0'></td>
</tr>
</table>
<table width='600' border='0' cellspacing='0' cellpadding='7'>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr bgcolor='#FFFFC0'>
<td width='40'></td>
<td width='250'>Data 1:</td>
<td width='310'> $data1 </td>
</tr>
<tr bgcolor='#CFF2FF'>
<td></td>
<td>Data 2:</td>
<td>$data2</td>
</tr>
<tr bgcolor='#CBFFCB'>
<td></td>
<td>Data 3:</td>
<td>$data3</td>
</tr>
<tr bgcolor='#CFF2FF'>
<td></td>
<td>Data 4:</td>
<td>$data4</td>
</tr>
<tr bgcolor='#CBFFCB'>
<td></td>
<td>Data 5:</td>
<td>$data5</td>
</tr>
<tr bgcolor='#CFF2FF'>
<td></td>
<td>Data 6:</td>
<td>$data6</td>
</tr>
<tr bgcolor='#CBFFCB'>
<td></td>
<td>Data 7:</td>
<td>$data7</td>
</tr>
<tr bgcolor='#CFF2FF'>
<td></td>
<td>Data 8:</td>
<td>$data8</td>
</tr>
<tr bgcolor='#CBFFCB'>
<td></td>
<td>Data 9:</td>
<td>

$var_selected=array($var1,$var2,$var3,$var4,$var5)
$cleaned = array_filter($var_selected, 'strlen')
foreach($cleaned as $show_vars)
{
echo $show_vars . \"<br/>\"
}

</td>
</tr>
<tr bgcolor='#FFC0C0'>
<td></td>
<td>Data 10:</td>
<td>$data10</td>
</tr>
<tr bgcolor='#FFFFFF'>
<td></td>
<td></td>
<td></td>
</tr>
<tr bgcolor='#FFE9D9'>
<td></td>
<td></td>
</tr>
<tr bgcolor='#E2DEDE'>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
; ?>

Any help would be gratefully accepted as this is driving me up the wall.
numb00000nuts
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sun Jun 12, 2011 4:31 am

Re: Array in email

Postby egami » Mon Jun 13, 2011 4:32 am

I don't see anywhere, where you are trying to actually email this stuff..
so, you might want to start there..

php.net/mail
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2197
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Array in email

Postby ravisoni6262 » Thu Jun 16, 2011 3:47 am

what kind of programming is this... where you are using mail function and you want to mail
read the documentation on mail
syntax:-

mail(string $mailto,string $subject,string $header, string additional header);

if you new to PHP programming kindlly reach at php-mechanic.blogspot.com it will help you a lot.
ravisoni6262
New php-forum User
New php-forum User
 
Posts: 13
Joined: Mon Jun 13, 2011 4:08 am


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron