top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to check for an Empty field in a Form?

0 votes
408 views
How to check for an Empty field in a Form?
posted Jun 12, 2014 by Amritpal Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

You can check in two ways using php and javascript. If You want client side validation then you can use javascript or if you want server side validation then you can use php.
Using javascript-

if(document.formnm.fieldnm.value=='')
{
alert('your message');
return false;
}

Using php-

if($_REQUEST['fieldnm']=='') { echo "Your Message"; }

answer Jun 13, 2014 by Karamjeet Singh
Similar Questions
0 votes

I have php script form which I used to input Members Details of my system into the MySQL database. My requirement is to display the last member's details in a input box.

+2 votes

I have a date field on an html form that users may leave blank. If they do leave it blank I want to write the date 01/01/1901 into the mysql table. How can I accomplish this and where in my .php script file should I put the code?

...