Issue in the multiple textarea

Hi all,

Below is my php code , basically the code will loop the posted
selected country.
My question is how to differentiate the HTML tag name below :

<td class="normal"><textarea id="location_address_1"
name="location_address[]" class="normal" rows="5"
cols="48"></textarea></td>

for e.g :

Country Address1 Address2
UK London Oracle Building
UK Liverpool Liverpool Tower
USA Boston Boston avenue

I have many multiple country which are the same and different.
How to get the correct $_POST values from it ?



<?php
while (list($name, $country)=each($selected_countries))
{
if ($country != '')
{
?>
<tr id="country_tr">
<td class="normal" > </td>
<td><span class="normal"><b>Country :</b></span></td>
<td class="normal" > </td>
<td class="normal" ><b><?php echo $country; ?></b></td>
</tr>
<tr id="address_location_1_tr">
<td class="normal" > </td>
<td>
<span class="normal">Address of Location 1:</span>
</td>
<td class="normal" > </td>
<td class="normal"><textarea id="location_address_1"
name="location_address[]" class="normal" rows="5" cols="48"></
textarea></td>
</tr>
<tr id="address_location_2_tr">
<td class="normal" > </td>
<td>
<span class="normal">Address of Location 2:</span>
</td>
<td class="normal" > </td>
<td class="normal"><textarea id="location_address_2"
name="location_address[]" class="normal" rows="5" cols="48"></
textarea></td>
</tr>
<tr id="postalcode_tr">
<td class="normal" > </td>
<td><span class="normal">Postal Code :</span></td>
<td class="normal" > </td>
<td><input type="text" id="postalcode_text" class="normal"
size="18" name="postalcode[]" value=""></td>
</tr>
<tr>
<td class="normal" > </td>
<td class="normal" > </td>
</tr>
<?php
}
}
?>
<tr>
weetat.yeo [ Fr, 09 März 2007 10:18 ] [ ID #1652903 ]

Re: Issue in the multiple textarea

weetat <weetat.yeo [at] gmail.com> wrote:

> Hi all,
>
> Below is my php code , basically the code will loop the posted
> selected country.
> My question is how to differentiate the HTML tag name below :
>
> <td class=3D"normal"><textarea id=3D"location_address_1"
> name=3D"location_address[]" class=3D"normal" rows=3D"5"
> cols=3D"48"></textarea></td>

Why not use a primary key, and set that in the name?
name=3D"location_address[123]"

IMHO, using the [<empty>] construct is only usefull for either checkboxe=
s =

where the value can more or less reliably be set, or for adding data. It=
's =

not terribly usefull for editing.
-- =

Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions: http://tinyurl.com/anel
Rik [ Fr, 09 März 2007 21:10 ] [ ID #1652917 ]
PHP » alt.php » Issue in the multiple textarea

Vorheriges Thema: Php et MySQL
Nächstes Thema: PHP and JAVA problem