p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: empty function not working


Message #1 by "Dominic Savio" <kselvanathan@y...> on Wed, 25 Sep 2002 20:50:57
Hello,
Below is the code that tests if the textbox from a form is empty. $1stname
- is the textbox name from the referring page.

if(empty($1stname)) error_message("Empty");

I copied it as in the book but it does not work. The following is the error
is the message I get.

Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
/home/sites/site183/web/phptest/formverify.php on line 102

Could anyone throw some light on this please? Been at it for some time.

Thanks for your help.

Selva
Message #2 by "Nikolai Devereaux" <yomama@u...> on Wed, 25 Sep 2002 13:44:07 -0700
> if(empty($1stname)) error_message("Empty");

You have an invalid variable name.  Variable names cannot begin with a digit.

For more information, see http://www.php.net/language.variables


Take care,

Nik

Message #3 by "Gellings, C.O." <gellingsco@p...> on Wed, 25 Sep 2002 22:50:45 +0200
Hi,
try:
if(empty($1stname)) $error_message("Empty");

instead of:
if(empty($1stname)) error_message("Empty");

mth,

Carl


-----Original Message-----
From: Dominic Savio [mailto:kselvanathan@y...]
Sent: 25 September 2002 20:51
To: beginning php
Subject: [beginning_php] empty function not working


Hello,
Below is the code that tests if the textbox from a form is empty. $1stname
- is the textbox name from the referring page.

if(empty($1stname)) error_message("Empty");

I copied it as in the book but it does not work. The following is the error
is the message I get.

Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
/home/sites/site183/web/phptest/formverify.php on line 102

Could anyone throw some light on this please? Been at it for some time.

Thanks for your help.

Selva


  Return to Index