Thanks in advance to those who can help with this!!
I have code in a php file that pulls values from a table to display in a dropdown field in a form
[php]$rarity = $dbObj->cgs(“tbl_rarity”, “”, “del_status”, “0”,“rarity_name”,"",false);
while($row_rarity = @mysql_fetch_array($rarity))
{
$rarity_id[] = $row_rarity[‘id’];
$rarity_value[] = $row_rarity[‘rarity_name’];
$rarity_min[] = $row_rarity[‘price_from’];
$rarity_max[] = $row_rarity[‘price_to’];
}
$smarty->assign(“rarity_id”, $rarity_id);
$smarty->assign(“rarity_value”, $rarity_value);
$smarty->assign(“rarity_min”, $rarity_min);
$smarty->assign(“rarity_max”, $rarity_max);[/php]
The code works fine and does what I need on the user form. There is also a field on the user form for PRICE, which is
<input type="text" name="price" id="exD_price"/>
Right now, I have to manually enter a value in that field of my choosing. The goal is to have it take the $rarity_min and $rarity_max values associated with the chosen rarity from the dropdown menu, and automatically insert a value in the price field that falls within the range of the min and max numbers, and each time I change a value in the dropdown it generates a new number and inserts it in to the price field.
In the php code I tried creating something
[php]$rprice=rand($rarity_min, $rarity_max);[/php]
and had added a value to the like value="{$rprice}", but after I select an option in the dropdown, nothing appears in the price field. I imagine there has to be an OnUpdate sort of function that needs to be called after the dropdown value is changed, but how do I do that in php?