Reply to Re: Replacing key in associative array

Your name:

Reply:


Posted by Geoff Berrow on 01/31/07 09:22

Message-ID: <bARvh.187755$Kh7.174122@fe2.news.blueyonder.co.uk> from
David Smithz contained the following:

>However, to improve presentation in some cases, I want to be able to rename
>the field name that is displayed in the email. So in the example above we
>might want to replace firstname with "First Name".

What I do is create a lookup array.

$lookup=array("firstname"=>"First name", "lastname"="Last
name","addr1"=>"Address line 1", ... );

Your values will be returned in the $_POST array so basically it is
something like this

$mailbody= "Values submitted from form\n\n";
foreach($_POST as $key=>$value){
$mailbody.= $lookup[$key]." - ".$value."\n";
}

I sometimes have an exclude array too because you may not want to
display submit buttons or hidden fields.

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация