Reputation: 678
I wanted to know if there is a better way to layout my form without having to create four check-boxes for the user to input 4 quarters as 25+25+25+25 = 1.00 to buy a drink.
Currently, I just have one check-box for each denomination(Nickles, Dimes and Quarters) I want to use.
I was wondering if there is better way in php and html that I can set a button, so that the user can only click a button for just quarters such that one click equates to 25 on the php side, and two clicks equates to 50 on the php side.
For example a user can click the quarters button once, and the value sent to the php script should be 25, and if the user clicks on nickles twice the value should be 5+5 = 10.
<form>
<label>Input Money Denominations</label>
<br />
<LABEL><INPUT TYPE="checkbox" NAME="money1" VALUE="Quarters">Quarters</LABEL>
<LABEL><INPUT TYPE="checkbox" NAME="money2" VALUE="Dimes"> Dimes</LABEL>
<LABEL><INPUT TYPE="checkbox" NAME="money3" VALUE="Nickles"> Nickles</LABEL>
</form>
<!--They are distinguished by their unique VALUEs
Only the value of the checked checkboxes will be passed to the php script.-->
<!--End Checkboxes for money option-->
<!--Submit button-->
<INPUT TYPE="submit" NAME="money" VALUE="Submit Denomination">
<!--The type of button tells what it does. The name is optional unless you are using a script that requires it(php).
Upvotes: 0
Views: 233
Reputation: 233
If you want to try clicking to "increment" the number of quarters input, you may want to use javascript, which can keep track of the intermediary change on the client-side, until the user has clicked enough times for the dollar (for example).
Upvotes: 0
Reputation: 526623
Use a select
dropdown instead?
<select name="quarters">
<option value="0">0</option>
<option value="25">1</option>
<option value="50">2</option>
<option value="75">3</option>
<option value="100">4</option>
</select>
Upvotes: 1