get - PHP is_nan function: Notice: A non well formed numeric value encountered -



I want to check that the $ _GET method is an AN code (only numeric) and check that There is a number when it does not happen to two, then I want to redirect to another page, and want to exit php script.

  if (! Isset ($ _GET ["ean"])) {header ('location: /products.php'); Go out(); } Else {if (is_nan ($ _ receive ["EAN"])) {header ('location: /products.php'); Go out(); }}   

When the $ _GET ["ean"] = 234234 SD (therefore, it is not numeric) is a php error:
Notice: a non-well Created in the numerical value created ..... line 9 is the line with 9D is_nan function.

There is a boat. View the docs:

For this reason, is_nan wants a as the name of a parameter . It will tell you whether it is Nain or not.

In your case, you want is_numeric .

  if (! Is_numeric ($ _GET ["EAN"])) {}    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -