...

View Full Version : Resolved help with script to email values up to 240 fields



Jodarecode
03-17-2009, 05:21 PM
I'm trying to avoid the brackets if at all possible since certain codes are dependent on no brackets.

I found a solution but I'm back to the beginning with an old question again.

I need all the empty rows to not show when emailed or printed and to only show non empty values in there respected columns only.


foreach($_POST as $key => $val){
if(preg_match("/textbox_r\d+\_c1/", $key)){
$msg .= "<tr><td>$val</td>";
};
if(preg_match("/textbox_r\d+\_c2/", $key)){
$msg .= "<td>$val</td>";
};
if(preg_match("/textbox_r\d+\_c3/", $key)){
$msg .= "<td>$val</td>";
};
if(preg_match("/textbox_r\d+\_c4/", $key)){
$msg .= "<td>$val</td>";
};
if(preg_match("/textbox_r\d+\_c5/", $key)){
$msg .= "<td>$val</td>";
};
if(preg_match("/textbox_r\d+\_c6/", $key)){
$msg .= "<td>$val</td>";
};
if(preg_match("/textbox_r\d+\_c7/", $key)){
$msg .= "<td>$val</td>";
};
if(preg_match("/textbox_r\d+\_c8/", $key)){
$msg .= "<td>$val</td>";
};
if(preg_match("/textbox_r\d+\_c9/", $key)){
$msg .= "<td>$val</td></tr>";
};
};

Jodarecode
03-17-2009, 05:42 PM
OK, fixed that

Now it pushes the values one TD to the right leaving a blank TD in the beginning and extending the 9th TD into the 10th column, Why would this be happening? any ideas?



for($a = 0; $a <= 240; $a++) {
$emptyrow = true;
$temp[] = '<tr>';
for($b = 0; $b <= 9; $b++) {
$temp[] = '<td align="right">' . $_POST['textbox_r'.$a.'_c'.$b] . '</td>';
if($_POST['textbox_r'.$a.'_c'.$b] != '')
$emptyrow = false;
}
$temp[] = '</tr>';
if($emptyrow == false)
$out[] = implode($temp, '');
unset($temp);
}
$msg .= implode($out, '');

Jodarecode
03-17-2009, 05:58 PM
Resolved!

needed to change

for($b = 0; $b <= 9; $b++)
to

for($b = 1; $b <= 9; $b++)


for($a = 0; $a <= 240; $a++) {
$emptyrow = true;
$temp[] = '<tr>';
for($b = 1; $b <= 9; $b++) {
$temp[] = '<td align="right">' . $_POST['textbox_r'.$a.'_c'.$b] . '</td>';
if($_POST['textbox_r'.$a.'_c'.$b] != '')
$emptyrow = false;
}
$temp[] = '</tr>';
if($emptyrow == false)
$out[] = implode($temp, '');
unset($temp);
}
$msg .= implode($out, '');



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum