I would change 2 to 3 in this part
// we can also check for the range here
// if it's more than 2 characters, then we are out of the range
if(str_len(name_str) > 2)
So we will allow to enter value which is made out of 3 characters.
Then I would convert string into the variable using
str_to_num.
And at the end I would check if this variable is higher than 150 or not. If it is, then give error, if it is not then save data.
Best regards!