select item and verify right amount

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nite4000
Forum Contributor
Posts: 209
Joined: Sun Apr 12, 2009 11:31 am

select item and verify right amount

Post 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
User avatar
andyhoneycutt
Forum Contributor
Posts: 468
Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls

Re: select item and verify right amount

Post 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.
Post Reply