If $name_X has a value, then print the line with all the info (itemno_X, Name_X, Qty_X, Price_X etc. etc..)
In my code i did 20 lines manually and it is printing the invoice right, no problem. So the only thing missing is creating the loop do print up to 100 lines.
Here is the code i have to print 20 lines :
Code: Select all
if( $NAME_0 ) {$strMessageBody .= "<TR ><TD>$ID_0 </TD><TD> $NAME_0</TD><TD align='right'>$QUANTITY_0</TD><TD align = 'right'>$PRICE_0 </TD><TD align = 'left'>/$UofM_0</TD><TD align = 'right'>$extvalue</TD></TR>";}
if( $NAME_1 ) {$strMessageBody .= "<TR><TD>$ID_1 </TD><TD> $NAME_1</TD><TD align='right'>$QUANTITY_1</TD><TD align = 'right'>$PRICE_1 </TD><TD align = 'left'>/$UofM_1</TD><TD align = 'right'>$extvalue</TD></TR>";}
if( $NAME_2 ) {$strMessageBody .= "<TR><TD>$ID_2 </TD><TD> $NAME_2</TD><TD align='right'>$QUANTITY_2</TD><TD align = 'right'>$PRICE_2 </TD><TD align = 'left'>/$UofM_2</TD><TD align = 'right'>$extvalue</TD></TR>";}So basically, it is printing the line IF there is information inside $NAME_X
I am sure there is something that can be done to loop it 100 times avoiding to write 100 lines manually.
(Waiting for Celauran here
Code: Select all
for ($x = 0; $x <= 100; $x++) {
$STRNAME = '$NAME_' . $x ;
$STRQTY = '$QUANTITY_' . $x;
etc... etc... for all the other fields of info.
if ($STRNAME) {$strMessageBody .= "<TR ><TD>$STRNAME </TD><TD>$STRQTY </TD></TR>";}
}thanks again for helping.