i have variables $CV1, $CV2, $CV3 … How to get the values of these variable inside while loop in PHP? Below is my code
$CV1=$fetch->Custom_field1;
$CV2=$fetch->Custom_field2;
$CV3=$fetch->Custom_field3;
$CV4=$fetch->Custom_field4;
$query=mysql_query("select * from customfields where CustomField like '%Invoice%' and CustomLabel != ''");
while($get=mysql_fetch_object($query))
{
$i++;
$Label=$get->CustomLabel;
$CFV='$CV'.$i;
echo "<tr><td>$Label</td><td><input type='text' name='custom_field$i' value='$CFV'></td></tr>";
}
but instead of getting the value of $CV1, $CV2. I’m getting the variable name itself as output. $CV1, $CV2, etc.
You can use:
See Codepad Example