View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0008242||phpList 3 application||General||public||13-10-06 21:44||20-04-10 03:08|
|Target Version||Future developments||Fixed in Version|
|Summary||0008242: Method for Selecting Recipients by Zip Code|
|Description||It is EXTREMELY important to me to be able to target mail recipients by zip code, and phplist just doesn't have any workable way to do this. So here is a solution. It's not elegant (maybe someone could improve on it?), but it does work.|
It requires that you have attributes in your database as:
'Zip Code' (type: textline)
'Targeted' (type: checkbox)
(these can be named anything)
Files attached are:
targetzip.php (the script that does the job)
zipcodes.tab (sample list of zip codes to be targeted)
listattr.php (displays your attributeIDs)
In the attached targetzip.php script, you'll need to change your database login parameters, as well as the following 2 variables:
$zipcodeattr = "7"; //attributeid for zipcode field
$targetdattr = "16"; //attributeid for 'targeted' field
These must be replaced with the appropriate attributeid's from your database (CAUTION: if you get these wrong you could erase valuable data. Your attribute definitions are stored in table 'phplist_user_attribute'. You can view it using something like phpMyAdmin, or use the attached quick & dirty script 'listattr.php' to list your user-defined attributes)
Okay, here's how it works: the script 'targetzip.php'
-first clears all 'targeted' flags from any previous selection, then
-reads zipcodes from'zipcodes.tab' (the attached sample is a list of all zip codes within 100 miles of Wheaton IL)
-generates a list of userids matching each zipcode in the list, and
-sets the 'targeted' flag to 'on' for each user that matches
You can then use your 'targeted' attribute as a mailing criterion.
To determine what zip codes are selected, simply edit 'zipcodes.tab' using Excel or a text editor and re-upload. I use a program called 'Zip Code Distance Wizard' to find zipcodes within a specified radius of my target location.
Hope this helps someone. I'm a total newbie at PHP and mySQL, but I sure learned a lot doing this.
|Tags||No tags attached.|
targetzip.zip (3,784 bytes)
That's very interesting for sure, and I can imagine it will be useful for other people. Have you posted it in the "mods" forum? If so, can you post the thread here, so it can be monitored?
I think people are more likely to search the forums for contributions like this.
well, actually I posted it first in the "Answers,Howtos" forum at http://forums.phplist.com/viewtopic.php?t=6762 (but for some reason I was not able to upload the attachment there). Hernol suggested I post it here.
Should I post it in the "Mods" forum as well?
||no, that's fine thanks. Just one links into the forums will be sufficient|
It is posted on the forum by kyleknapp in the following adress: