Re: [SLUG] Required fields in PHP

From: Logan Tygart (logan1304@comcast.net)
Date: Thu Feb 19 2004 - 05:11:08 EST


On Wed, 2004-02-18 at 19:29, Paul M Foster wrote:
> When coding forms in PHP, is there a _simple_ way to ensure certain
> required fields are actually filled out?
>
> Paul

You can use empty() or isset()

<?php
$var = 0;

// Evaluates to true because $var is empty
if (empty($var)) {
   echo '$var is either 0, empty, or not set at all';
}

// Evaluates as true because $var is set
if (isset($var)) {
   echo '$var is set even though it is empty';
}
?>

The Logan

-- 
05:05:01 up 3 days, 10:22, 3 users, load average: 0.06, 0.39, 0.72
Did you know the word "gullible" isn't in the dictionary?
ICQ: 72101412 AIM/Yahoo: LoganTheClever
Registered Linux User: 277727


----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:00:17 EDT