forms - How do you change a text variable to an int in PHP? -


I have a variable that is inputted in a text field by a POST call.

  Lenght:    

"text" id = "lenght" size = "2" />

From php code:

  $ length = $ _POST ['band']; $ Url = substr ($ url, 0, $ length);  

It does not seem to work and there is only one reason that I think this is not working, because the $ length is defined as text and No interval

two things:

  1. this does not work Because you misspelled length & lt; -> Length

  2. The correct way to convert the string to an integer is using the function infall.


$ length = interval ($ _ POST ['length']); $ Url = substr ($ url, 0, $ length);

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -