Re: foreach ?!

From: Date: Fri, 06 Apr 2001 00:01:38 +0000
Subject: Re: foreach ?!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-47352@lists.php.net to get a copy of this message
> if ($mem_obj->home_email1!=='') > $vars["home_email1"] = "<input type=hidden name=home_email1 > value=$mem_obj->home_email1>"; I think I don't understand what you really want to do. Anyway what's $mem_obj? Does $mem_obj->home_email1 have $HTTP_POST_VARS['home_email1'] before you test it? Sound like this is the cause to me. Regards, -- Yasuo Ohgaki ""TV Karthick Kumar"" <tvkarthick@myrealbox.com> wrote in message news:031001c0bde4$f1638c00$760aa8c0@office.tutticom.com... > 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 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#47352) next »