Page 1 of 1

select item and verify right amount

Posted: Thu Jun 17, 2010 3:57 pm
by nite4000
hey all

Here is my code first of all

Code: Select all

<table width="100%" align="center" class="style1">
                    
					  
                      <?php
$r = mysql_query("SELECT * FROM packages") or die(mysql_error());
    while($row = mysql_fetch_array($r, MYSQL_ASSOC)) {
if($row['pack_status']=='1')
 echo'
<tr>
<td></td><td width="114" class=plan_left>'.$row['name'].'</td><td width="179" class=plan_middle>Spend Amount</td><td width="118" class=plan_right>Rate</td></tr>';
	$q = mysql_query("SELECT * FROM plans WHERE parent='{$row['id']}'") or die(mysql_error());
    while($pla = mysql_fetch_array($q, MYSQL_ASSOC)) {
if($pla['status']=='1')

echo'
	<tr><td><input type="radio" value="'.$pla['id'].'" name="plan"></td>
<td width="114" class=style2>'.$pla['plan_name'].'</td>
<td width="179" class=style2>'.$pla['min_deposit'].' - '.$pla['max_deposit'].' </td>
<td class=style2 width="118">'.$pla['percent'].'</td>
</tr>

	';
 }
 }


 ?>
 <tr>
                      <td width="116"><span class="style2"><img src="../images/forms/money_dollar.png" width="16" height="16" /> Amount</span></td>
				      <td width="144"><input name="amount" type="text" class="textbox" id="amount" size="25" maxlength="25" /></td>
			        </tr>
				    <tr>
                           
				      <td colspan="2"><div align="center">
				        <input name="save" type="submit" class="n_register" id="save" value="Invest Funds" />
			          </div></td>
			        </tr>
                  </table>
					</form><?php } ?>


Next here is what I am trying to do i just need to do a if statment

I need to when I select a radio button which is near each plan and take whats i enter in the text box and be sure that the amount in the text box isnt smaller then the min deposit or the max deposit.

as i said i think i just need a if statment but i need to get it to read the selected buttons min and max depo

Thanks

Re: select item and verify right amount

Posted: Sat Jun 19, 2010 12:20 pm
by andyhoneycutt
If you want to do this client side, add some hidden fields with the values you are comparing against (the min and max per plan), and use some javascript to compare them to the user input.

Server side, just check the values against what you have in the database to make sure they meet the criteria.