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

Your name:

Reply:


Posted by Rik Wasmus on 10/05/07 13:57

On Fri, 05 Oct 2007 15:43:43 +0200, james.n.grace@gmail.com =

<james.n.grace@gmail.com> wrote:

> The form is very lengthy, but here is the pertinent form code:
>
>
> - - - - - - - - - - S N I P - - - - - - - - - -
> <form action=3D"/res/sites/east_coast_sales/resources/
> email_form_send.php" method=3D"post" name=3D"EmailForm" id=3D"EmailFor=
m">
> <SELECT NAME=3D"FromAddress">
> <OPTION SELECTED VALUE=3D"">Click here to select YOUR email address.</=

> OPTION>
> </SELECT>
> <SELECT NAME=3D"ToAddress">
> <OPTION SELECTED VALUE=3D"">Click here to select the RECIPIENT.</OPTIO=
N>
> </SELECT>
> <SELECT NAME=3D"CCAddress">
> <OPTION SELECTED VALUE=3D"">Click here to "Carbon Copy" this
> submission.</OPTION>
> </SELECT>
> <SELECT NAME=3D"BCCAddress">
> <OPTION SELECTED VALUE=3D"">Click here to "Blind Carbon Copy" this
> submission.</OPTION>
> </SELECT>
> <input name=3D"FileName" type=3D"hidden" id=3D"FileName" value=3D"<%=3D=
FileName
> %>">
> <input name=3D"DirPath" type=3D"hidden" id=3D"DirPath" value=3D"<%=3D =
DirPath
> %>">
> <input name=3D"RIDValue" type=3D"hidden" id=3D"RIDValue" value=3D"<%=3D=
RIDValue
> %>">

So I assume these three are repeated? On a post, avery subsequent post =

field with the same name would overwrite the previous one in the 'magic'=
=

$_POST array. To keep the form the same would require parsing php://inpu=
t =

yourself (or $HTTP_RAW_POST_DATA). Not a very pleasant task.
If you can change the fieldnames in the form itself, add '[]' to the =

repeated fields, like:
<input name=3D"FileName[]" type=3D"hidden" value=3D"<%=3D FileName %>">

In the receiving script you could do this:

<?php

if(is_array($_POST['FileName']) && !empty($_POST['FileName'])){
foreach($_POST['FileName'] as $key =3D> $value){
//do your thing
echo "$key: {$_POST['FileName'][$key]} {$_POST['DirPath'][$key]} =

{$_POST['RIDValue'][$key]}\n";
}
}
-- =

Rik Wasmus

[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

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