kannu Posted March 27, 2009 Share Posted March 27, 2009 hey guys, i have a html output which comprises of various variables where there values change on user selection, and their combined result together is output in html as a string the following is the code <td><span id="custom_carat"><?=$row_prod['total_carat_weight']?></span> Carat <span id="center_diamond1"><? echo $default_diamond['shape']; ?></span> <?=substr(substr(stripslashes($row_prod['product_name']),11),0,-14) ?><span id="custom_gold1"><?=$default_gold['text']?></span> Gold </td> Is it possible that I can assign the entire output of the above to a php variable. if you can please let me know thanks Link to comment https://forums.phpfreaks.com/topic/151383-assign-a-whole-html-output-to-string-variable/ Share on other sites More sharing options...
lonewolf217 Posted March 27, 2009 Share Posted March 27, 2009 this should work <?php $test = "<td><span id=\"custom_carat\">".$row_prod['total_carat_weight']."</span> Carat <span id=\"center_diamond1\">".$default_diamond['shape']."</span>". substr(substr(stripslashes($row_prod['product_name']),11),0,-14) ."<span id=\"custom_gold1\">".$default_gold['text']."</span> Gold </td>"; ?> Link to comment https://forums.phpfreaks.com/topic/151383-assign-a-whole-html-output-to-string-variable/#findComment-795104 Share on other sites More sharing options...
kannu Posted March 27, 2009 Author Share Posted March 27, 2009 man, thanks LoneWolf217, that worked like a charm, i was trying to figure it out for over 2 hours. thanks again Link to comment https://forums.phpfreaks.com/topic/151383-assign-a-whole-html-output-to-string-variable/#findComment-795124 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.