Search code examples
htmlformsuploadsql-injection

accept only number in input text box without using script


How to allow only number in input text box

<input type="text" name="price" id="input-country" required placeholder="Enter Your Price" accept="number">

i used the above method but its not working when i use only allowed type in image input i use the following method

<input type="file" class="custom-file-input" accept="image/x-png, image/gif, image/jpeg">

this method works fine in same way how to allow only number and how to allow only text, and protect form SQL injection


Solution

  • Click this for checking how to enter numeric text only in HTML

    If you are using HTML5 then use <input type="number">

    If you realy wish to get rid of SQL injection Use this