foreach ?!

From: Date: Thu, 05 Apr 2001 15:27:36 +0000
Subject: foreach ?!
Groups: php.general 
Request: Send a blank email to php-general+get-47275@lists.php.net to get a copy of this message
Hi List.. I have the following code, which actually sets up the value of of the hidden variable and passes onto the next page and there I manipulate the data and send them emails. But passing the hidden variables depends upon the mem_id, that is the hidden variable has to be passed for 'n' number of records. For example, if I have two records then the I am checking the first record and finding out the available email id (the various chances are home_email1, home_email2, work_email1, work_email2 etc. and I have max. 4 email addresses in each record) and passing it as an hidden variable to the next page. Here it's very important to note that, at times, 4 emails will be available or 4 emails will NOT be available (it'll be empty) and sometimes only 1 or 2 will be available. There are possibilities like this. Now, as I have this code in place, what's happening is : when I pass any of the email address of the first record, it's getting passed, where the home_email1 is available and then when I pass any of the email address of the second record, it's getting passed - BUT it's getting overwritten and I have the value of the second record and I lost the first one. What I want is - I want the hidden variables to be passed and kept for the number of records selected and then I would use pass them as hidden variables and use it in the next page. I know that I have to use Arrays for this, but what's next ?. Here's my code: if ($mem_obj->home_email1!=='') $vars["home_email1"] = "<input type=hidden name=home_email1 value=$mem_obj->home_email1>"; if ($mem_obj->home_email2!=='') $vars["home_email2"] = "<input type=hidden name=home_email2 value=$mem_obj->home_email2>"; if ($mem_obj->work_email1!=='') $vars["work_email1"] = "<input type=hidden name=work_email1 value=$mem_obj->work_email1>"; if ($mem_obj->work_email2!=='') $vars["work_email2"] = "<input type=hidden name=work_email2 value=$mem_obj->work_email2>"; Any help is much useful to me. Thanks in advance. ~ Karthick

« previous php.general (#47275) next »