When you submit the form, all of the fields are sent in the $_POST array, even if they are blank -- so rather than being unset, a blank 'address' field will be set to '' (empty string).  So the count is really not very helpful, and all of the OR'ed conditions should be changed to something like:

(isset($_POST['firstname']) && !empty($_POST['firstname'])) OR ...

- Demian

From: Christian Dabrowski [dabrowski.christian@fh-swf.de]
Sent: Thursday, January 03, 2013 7:20 AM
To: vufind-general@lists.sourceforge.net
Subject: Re: [VuFind-General] userID in email template


a further question ocurred:

i want the submit only send the mail when there is at least one field filled out. For this I added count() with the parameter of at least two (submit + a field), but it sends the email even if all fields are empty. What do I do wrong?

        if (count($_POST) > 2 AND
           (isset($_POST['submit']) AND
            isset($_POST['firstname']) OR
            isset($_POST['lastname']) OR
            isset($_POST['address']) OR
            isset($_POST['ZIP']) OR
            isset($_POST['phonenumber']) OR
            isset($_POST['mail']) OR



Am 03.01.2013 08:03, schrieb Christian Dabrowski:
Hi Demian and Al,

thanks for the hint and
the explanation! Now it works like a charm!!

all best,


Am 02.01.2013 17:09, schrieb Alan Rykhus:
Hello Christian,

You are setting $userid to be a string.

When you assign 

  $recordList['userid'] = $userid['userid'];

you are referring to $userid as an array, so it takes the first letter,
a string is an array of characters.


  $recordList['userid'] = $userid;


On Wed, 2013-01-02 at 11:37 +0100, Christian Dabrowski wrote:
Hi all,

I tried to add the user ID into an email template and encountered a 
problem - namely, only the first charakter of the variable is passed to 
the email template. I did the following:

I added in the Aleph driver, in the function getMyProfile($user) these 

         $userid = (string) $xml->z304->{'z304-id'};   //here the user 
ID is stored

         // ID
         $recordList['userid'] = $userid['userid'];

In the email template I've changed the variable in the subject to this:

{translate text="This email was sent from"}: {$profile.userid}

Instead of getting the full ID (e.g. USP000090661) I only get "U"
What did I do wrong?

I'd be thankful for any hints!

Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
VuFind-General mailing list

Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:

VuFind-General mailing list