SitePoint Enthusiast
How to concatenate 3 variables in one table cell
I'm very new to php, but I'm trying to modify a shopping cart and put 3 variables in one table cell instead of the 2 that were there originally. The original code was:
$content .= '<tr id="'.$item.'"><td>'.$crtName[$item].$sp_comments.'</td><td style="text-align:left;">'.$crtOptions[$item].'</td><td style="text-align:center;"><input class="quantity" name="'.$item.'" type="text" value="'.$crtQuantity[$item].'" /></td><td style="text-align:center;"><a href="'.$GLOBALS["CARTURL"].'?remove='.$item.'" class="crtRemove">'.mkt_SHOPCART_ITEM_REMOVE.'</a></td><td style="text-align:right;">'.$mkt_pk_item_amount.'</td></tr>';
The part I'm trying to change is:
<td>'.$crtName[$item].$sp_comments.'</td>
This code works fine and displays both variables in one cell. I want to add a 3rd variable to the cell, so I did this:
<td>'.$crtName[$item].$sp_comments.$sp_comments2.'</td>
The cell now displays $crtName[$item] and $sp_comments2 but not $sp_comments. Am I doing something wrong?
Your code is fine, it means the variable is empty.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks