Is there a way to just get the first numbers from the input date, for me is it just important to select a amount 1 to 200. I like the scrolling select type more than press the amount.
<form method="POST">
<label>How much do you want ?</label>
<input type="date" name="number">
<button>Send</button>
</form>
The idea is to make it easier for mobile users to select amount with scrolling to the number of amount.
<?php echo $_POST['number']; ?>
Output 20 (for example ifs user selected 20).
<input type="number" name="amount" min="1" max="200">
try this
EDIT you said like the scrolling select type
for that u need to do something
<select name="amount">
<option value="0" selected >select </option>
<option value="1" >1 </option>
----
so on to 200
----
<option value="200">200 </option>
</select>
i think input is more better :)
In your HTML use the number
type instead of date
:
<input type="number" min="0" max="200" step="1" name="number">
Your PHP code would be the same but if you wanted to enforce a numeric value you can cast it to an integer:
<?php echo (int) $_POST['number']; ?>
<label>Product Number:
<input pattern="[0-9]{3}" name="product" type="number" min="1" max="200"/>
</label>