Reply to HTML Form to email via PHP : Multiple Cart Items : Rewrite from ASP

Your name:

Reply:


Posted by james.n.grace@gmail.com on 10/05/07 04:29

I am trying to make the contents of a Web visitor's shopping cart
available via email, but can't get anything more than the final item
in their cart to display in the subsequent email. Changing the HTML
form method from the normal "post" to "get" yields the following in
the URL stream (I added carriage returns after each "&" to make things
easier to read):

FromAddress=jgrace%40extensis.com&
ToAddress=jgrace%40extensis.com&
CCAddress=&
BCCAddress=&

FileName=Quick+Start+Guide.pdf&
DirPath=%3A%3AMacBookPro%3APublic%3ADigital+Assets%3AIncoming
%3A9871263j+-+Special+Project%3AOfficial+Contract%3A&
RIDValue=5525&
Description=Test&

FileName=Slide5.PNG&
DirPath=%3A%3AMacBookPro%3APublic%3ADigital+Assets%3APortfolio
+Presentations%3A8.5%3A&
RIDValue=5520&
Description=slide&

As you can see, the shopping cart items are repeated with the same
"FileName", "DirPath", "RIDValue", and "Description" when they are
sent to the PHP page.


The PHP page which receives the form data is as follows:



- - - - - - - - - - S N I P - - - - - - - - - -



$RIDValue = $_POST['RIDValue'];
$FileName = $_POST['FileName'];
$DirPath = $_POST['DirPath'];
$Description = $_POST['Description'];

$ItemUrl = "http://127.0.0.1/netpub/server.np?
find&catalog=catalog&template=detail.np&field=itemid&op=matches&value=" .
$RIDValue . "&site=ecs";
$ThumbUrl = "http://127.0.0.1/netpub/server.np?thumbnail=" .
$RIDValue . "&site=ecs&catalog=catalog";

$Message.= "<TR><TD ALIGN='center' VALIGN='middle' BGCOLOR='#ffffff'
WIDTH='225'>";
$Message.= "<A HREF='" . $ItemUrl . "'> <IMG SRC='" . $ThumbUrl . "'
WIDTH='112' BORDER='0' ALT=''></A>";
$Message.= "</TD>";
$Message.= "<TD ALIGN='center' VALIGN='middle' BGCOLOR='#ffffff'
WIDTH='225'><FONT FACE='Arial,Helvetica,Geneva,Swiss,SunSans-Regular'
SIZE='3' COLOR='#ff0000'>" . $RIDValue . "</FONT><BR><BR><FONT
FACE='Arial,Helvetica,Geneva,Swiss,SunSans-Regular' SIZE='3'
COLOR='#000000'>" . $FileName . "<BR><BR><B>" . $Description;
$Message.= "</B></FONT></TR></TD>";




- - - - - - - - - - S N I P - - - - - - - - - -


I'm assuming that I have to somehow repeat the above section for each
occurence of "FileName", "DirPath", "RIDValue", and "Description".


I was able to do this quite easily in ASP with the following code:


- - - - - - - - - - S N I P - - - - - - - - - -


intFileCount = 0
for Each SubKey in Request("FileName")
intFileCount = intFileCount + 1
FileName = Request("FileName")(intFileCount)
DirPath = Request("DirPath")(intFileCount)
RIDValue = Request("RIDValue")(intFileCount)
Description = Request("Description")(intFileCount)
ItemUrl = "http://127.0.0.1/netpub/server.np?
find&catalog=catalog&template=detail.np&field=itemid&op=matches&value="
& RIDValue & "&site=ecs"
ThumbUrl = "http://127.0.0.1/netpub/server.np?thumbnail=" & RIDValue
& "&site=ecs&catalog=catalog"
strHTML = strHTML & "<TR><TD ALIGN=""center"" VALIGN=""middle""
BGCOLOR=""#ffffff"" WIDTH=""225"">"
strHTML = strHTML & "<A HREF=""" & ItemUrl & """> <IMG SRC=""" &
ThumbUrl & """ WIDTH=""112"" BORDER=""0"" ALT=""""></a>"
strHTML = strHTML & "</TD>"
strHTML = strHTML & "<TD ALIGN=""center"" VALIGN=""middle""
BGCOLOR=""#ffffff"" WIDTH=""225""><FONT
FACE=""Arial,Helvetica,Geneva,Swiss,SunSans-Regular"" SIZE=""3""
COLOR=""#ff0000"">" & RIDValue & "</FONT><BR><BR><FONT
FACE=""Arial,Helvetica,Geneva,Swiss,SunSans-Regular"" SIZE=""3""
COLOR=""#000000"">" & FileName & "<BR><BR><B>" & Description
strHTML = strHTML & "</B></FONT></TR></TD>"
Next

- - - - - - - - - - S N I P - - - - - - - - - -

Anyway, the initial rewrite from ASP to PHP was quite easy.
Unfortunately, the final part is turning out to be much more of a
challenge!

Thanks in advance for your time and effort!

[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

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