Daniel-MD
Regular Member
- Dec 2, 2007
- 355
- 339
I use this to list values from a db:
and this to get an array with variables and pass to template:
Smarty Code:
Question is .. how do I check the variables sent from the form..
I dont want to do a new SQL query I want to use the array I've already defined....
if ($frm['action'] == 'purchase_referrals')
{
$errors = array ();
.....................
something like (if $plans.id[$frm['plan']]['status'] == 'active') go on..
the problem is I can not use $plan['$frm['plan']]['status'] coz the first column is the line no ..0 ,1 , 2 etc..
I think is simple but.. cant figure it out
Code:
//+++++++++++++++++++++++++++++++
// GET REFERRAL RATES(PLANS)
//+++++++++++++++++++++++++++++++
function get_ref_rates()
{
$plans= array();
$get = mysql_query("SELECT id,howmany,price,status FROM mdl_config WHERE item LIKE 'referrals' ORDER BY howmany ASC");
while ($row = mysql_fetch_array($get))
{
array_push ($plans, $row);
}
return $plans;
}
and this to get an array with variables and pass to template:
Code:
//---------- GET BUY PURCHASE REFS ITEMS --------
$plans= array();
$plans= get_ref_rates();
//-----------------------------------------------
Smarty Code:
Code:
<tr>
<td class="fieldsname">» Choose Plan:</td>
<td class="fieldsname">
<select class="generalborder" name="plan">
{section name=c loop=$plans}
<option value="{$plans[c].id}" {if $plans[c].id eq $frm.plan}selected{/if}>{$plans[c].howmany} referrals - ${$plans[c].price}</option>
{/section}
</select>
</td>
</tr>
Question is .. how do I check the variables sent from the form..
I dont want to do a new SQL query I want to use the array I've already defined....
if ($frm['action'] == 'purchase_referrals')
{
$errors = array ();
.....................
something like (if $plans.id[$frm['plan']]['status'] == 'active') go on..
the problem is I can not use $plan['$frm['plan']]['status'] coz the first column is the line no ..0 ,1 , 2 etc..
I think is simple but.. cant figure it out