How do I determine datatype of input values that am getting from my html form so that I can use them to bind parameters in prepared statement

前端 未结 2 585
日久生厌
日久生厌 2021-01-25 17:43

I want to dynamically determine the data type of input values I am getting from my HTML input form.this will assist me to bind parameter values of data I am inserting into my da

2条回答
  •  伪装坚强ぢ
    2021-01-25 18:16

    I want to dynamically determine the data type of input values i am getting from my HTML

    The "T" in HTML stands for "text". There is only one data-type in HTML, string. Any code that receives input originating from HTML must already be aware of what type of data to expect and convert the string input into that type.

    If your database expects a user's age to be an Integer, for example, then when your code receives that user input (a string), it must convert it to an Integer and then that Integer can be passed into the database.

提交回复
热议问题