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 do I check for an empty field in a form?


If you want to check whether a form field has a value or not, use the empty function

<?php
$formvalue 
"on";
if(empty(
$formvalue)) { echo "I am empty!"; }
?>


People sometimes get confused between isset and empty - the former just checks whether the variable is present or not but ignores any value it may or may not have.



ASK A QUESTION

More forms PHP Questions

is it possible to submit a form without a submit button

How do I know if magic quotes is switched on?

How do I email the contents of a form to me?

How do I make a website field mandatory?

How can I access information sent through GET on a form?



Custom Search