I want to add the [currency] in place of "afkv" the output would be : frt_9_3 9 = USD3 = device 1ThanksRon"> Please help with this value pickup code - Forums

Forums

Please help with this value pickup code

Ronn 17 Aug, 2014
Hello

I am not able to make this code work:

< ?php echo "\n         {$prices['frt_'.$form->data['currency'].'_afkv']}"; ? >


I want to add the [currency] in place of "afkv" the output would be : frt_9_3

9 = USD
3 = device 1

Thanks

Ron
Ronn 17 Aug, 2014
sorry not [currency] it is [device]
Ronn 17 Aug, 2014
Hi,

I have tried this code but I cannot find the error as it does not work:

< ?php 
$price_string = $form->data['frt'].'_'.$form->data['currency'].'_'.$form->data['device'];
$freight_value += "\n         {$prices[$price_string]}"; 
?>


Thanks

Ron
Ronn 18 Aug, 2014
Answer
I have been able to solve it.

Thanks
GreyHead 18 Aug, 2014
Hi Ronn,

We can't provide a free service for debugging user's bad PHP :-(

But - in this case the {$variable} syntax will not work if you add a string inside the {} - keep it just to the variable name.

Bob
Ronn 18 Aug, 2014
Thanks for that advice Bob.

I will keep it in mind.

Best wishes

Ronn
This topic is locked and no more replies can be posted.