Hello,
I want to pick up some form values in php. How can I do this ? The form field is below:
The original code is below that picks up value from my price array:
I want this code to work as per choice. Can I do something like this?😀
Please help. Thanks
Ron
I want to pick up some form values in php. How can I do this ? The form field is below:
<select name="currency" required="true" id="currency" onchange="setFlag(this.value)" style="font-family:Verdana, Geneva, sans-serif; width:150px; font-size:15px; border:1px solid #999;">
<option value="usd">usd</option>
<option value="eur">eur</option>
<option value="uah">uah</option>
<option value="inr">inr</option>
The original code is below that picks up value from my price array:
<?php $freight_value = ("\n {$prices['frt_usd_200']}"); ?>
I want this code to work as per choice. Can I do something like this?😀
<?php $freight_value = ("\n {$prices['frt_{currency}_200']}"); ?>
Please help. Thanks
Ron
Hi Ron,
Please try
Bob
Please try
<?php
$freight_value = "\n {$prices['frt_'.$form->data['currency'].'_200']}";
?>
Bob
Thanks Bob,
You really are the hero..😀 It works just fine..
Thanks again Bob. God bless you.
Ron
You really are the hero..😀 It works just fine..
Thanks again Bob. God bless you.
Ron
Hi Ron,
Please try
<?php $freight_value = "\n {$prices['frt_'.$form->data['currency'].'_200']}"; ?>
Bob
Bob
Just like {currency} I also have {type} in my form that I want to add to this code. Can I add it this way ? I tried it in two ways but it does not work. Please see below:
<?php $freight_value = "\n {$prices['frt_'.$form->data['currency'.'type']}"; ?>
<?php $freight_value = "\n {$prices['frt_'.$form->data['currency'].' '.$form->data['type']]}"; ?>
Do you have any suggestions for me.
Thanks again.
Ron
Hi Ron,
You really need to check the PHP manual from time to time. Neither of your versions are valid PHP, the first one has an invalid array index ['currency'.'type'] the second has got my eyes crossed with quotes and brackets. It's easier to break it into two parts. So please try:
Bob
You really need to check the PHP manual from time to time. Neither of your versions are valid PHP, the first one has an invalid array index ['currency'.'type'] the second has got my eyes crossed with quotes and brackets. It's easier to break it into two parts. So please try:
<?php
$price_string = 'frt_'.$form->data['currency'].'_'.$form->data['type'];
$freight_value = "\n {$prices[$price_string]}";
?>
Bob
This topic is locked and no more replies can be posted.