I am trying to dynamically create a variable name by crating a string of its name first. the problem is i can not find function to take a string and convert it into a variable that can be used. The variable I am trying to create is all ready there and has a value pulled from a DB, these variable are added below.
CODE-
<?
/***** Added for this post */
$SITE->Option4Total1s = 50;
$SITE->Option4Total1e = 100;
$SITE->Option4Total1x = 150;
$SITE->Option4Total2s = 200;
$SITE->Option4Total2e = 250;
$SITE->Option4Total2x = 300;
/****************************/
?> <table border="1" cellpadding="2" cellspacing="0">
<tr>
<td><b>Total Order Amount</td>
<td><b>Standard</b></td>
<td><b>Expedited</b></td>
<td><b>Express</b></td>
</tr>
<? for ($i = 1; $i < 12; $i++) { ?>
<tr>
<?
$compile_name = "Option4Total".$i."s";
$Option4Totals = "$"."SITE->".$compile_name;
$compile_name = "Option4Total".$i."e";
$Option4Totale = "$"."SITE->".$compile_name;
$compile_name = "Option4Total".$i."x";
$Option4Totalx = "$"."SITE->".$compile_name;
?>
<td><input type="text" name="Option4Max1" value="<? echo $SITE->Option4Max1; ?>"></td>
<td>$<input type="text" name="Option4Total<? echo $i; ?>s" value="<? echo $Option4Totals; ?>"></td>
<td>$<input type="text" name="Option4Total<? echo $i; ?>e" value="<? echo $Option4Totale; ?>"></td>
<td>$<input type="text" name="Option4Total<? echo $i; ?>x" value="<? echo $Option4Totalx; ?>"></td>
</tr>
<? } ?>
</table>
in the input tages, the value field i am trying to get right