Re: Creating $key, $value pairs
| From: | Ashley M. Kirchner | Date: | Sun, 25 Nov 2001 20:24:10 +0000 |
| Subject: | Re: Creating $key, $value pairs | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75668@lists.php.net to get a copy of this message | ||
Hank Marquardt wrote:
> if you do have extraneous ':'s
> elsewhere in the message then you'll need to be a little more picky with
> your regex stuff to only pick out what you want -- for example, your
> post has a couple of sentences that end with ':' before an example ...
> the script as written picks those up as key value pairs, but since
> you'll unlikely have those in your order messages I figure you're on
> safe ground for now --
Actually, some of those will end up being "blank", for example the 'BILL
TO:' line is always blank, I may not have all 3 lines of 'Address:' filled, etc.,
etc. And there may be more lines that might end up blank when someone places an order. And as you
pointed out, some lines might have :'s elsewhere in it. The 'Today's Date:'
line is one of those. And nothing is going to stop anyone from doing something like 'From:
Santa, To: Rudolph' in the 'Gift Message:' field. So I suppose I need to look out
for those, I just don't know who just yet. (and considering how much I *suck* at regexp
matching, that's going to be rather tricky for me)
> Of course the really easy way to do this is just to process the form
> output directly then you have your key/values nice and neat in
> $HTTP_POST_VARS already:) ... but I'm assuming this is on and processed
> by a separate server, or with a canned script that only gens emails, so
> this is what you need to do.
I don't have control over that process. I only receive the email once an order is placed.
The company that does the ordering and all of that good stuff has their own internal DB that they
maintain. A DB I don't have access to, so I'm stuck with having to re-invent the wheel.
Either way, thank you very much for your code. It is a great start for what I need done.
Thanks!
AMK4
--
H | "Life is the art of drawing without an eraser." - John Gardner
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:ashley@pcraft.com> .
303.442.6410 x130
Director of Internet Operations / SysAdmin . 800.441.3873 x130
Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave, #6
http://www.pcraft.com ..... . . . Boulder, CO 80303,
U.S.A.