Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* RE: [PHP3] Required fields
       [not found] <Pine.LNX.3.96.981020144344.21921A-100000@ns.eurobase.net>
@ 1998-10-20 22:20 ` Thatcher Hubbard
  0 siblings, 0 replies; only message in thread
From: Thatcher Hubbard @ 1998-10-20 22:20 UTC (permalink / raw)
  To: Tom Techoueyres; +Cc: AXP

PHP would do it just fine, but that requires an actual submit and reload of
the page.  I've had the best luck with JavaScript.  Name your variables:

<INPUT TYPE=TEXT NAME="Dumb">

Then, don't put a submit button at the bottom of the page, just put a plain
old button that calls a JavaScript function called validate() or whatever.

 function validate() {
	if document.formname.dumb = "dumb"
		alert("Dumb");
	else
		alert("Not dumb");
		formname.submit;
}

  This is a good way to do limited input validation.  If you have to do a
lot of it, it's good to write an actual include file with a validate
function.  The advantage is that you don't have to reload the page, and, you
have to learn some JavaScript in order to do it.  Netscape's
developer.netscape.com has a good piece on input validation with JavaScript.


-----Original Message-----
From:	Tom Techoueyres [mailto:tom@ns.eurobase.net]
Sent:	Tuesday, October 20, 1998 1:47 PM
To:	php3@lists.php.net
Subject:	[PHP3] Required fields

Hi,

What is the command in PHP that requires a field in a form not to be
empty?
I created a form and some fields are required, if the field is left blank
I would like to return an error message saying that the field needs to be
filled out.

Any feedback would be appreciated.

Thanks,

Tom Techoueyres
tom@eurobase.net



--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe@lists.php.net
To subscribe to the digest list:  php3-digest-subscribe@lists.php.net
For help: php3-help@lists.php.net  Archive:
http://www.php.net/mailsearch.php3




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-10-20 22:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Pine.LNX.3.96.981020144344.21921A-100000@ns.eurobase.net>
1998-10-20 22:20 ` [PHP3] Required fields Thatcher Hubbard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox