PHP Questions Home
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How can I check a value entered in a field on my form is a number?


There are several ways that you can check that this is the case. One of the simplest ways is to use a dedicated function, is_numeric - just pass it the value and it'll return true or false depending on whether it is a number or not.

Here's an example:

<?php
$formvalue 
"57a";
if(
is_numeric($formvalue)) { echo "Is a number"; } else { echo "Not a number"; }
?>


This prints 'Not a number' in this instance.



ASK A QUESTION

More forms PHP Questions

how to i decimal, comma, and $ format a number called from mysql displayed in a table cell using php. This is the call script and this is the formatting script How do I replace the $value=123... with my call script? Thanks

Can anyone made process.php of contact form here is contact form HTML and CSS code. -------------------------------- HTML -------------------------------- Name Phone

What are causes of seeing the actualPHP code in my web browser

how to avoid the refresh or goback to submit the post values in database

Hello, I an trying to figure out how to pass a variable email address to the contact form where you see the send-to-me@me.com. My contact page In a php file uses the following iframe embed: The contact script in feedback/contact. php



Custom Search