hi

this is the piece of code

------------------------------------------------------------------------------------------------
for($s=0;$s<$num;$s++)
  {
    $result = mssql_fetch_array($query);

$result[2] = number_format($result[2], 2);


"<tr border=1>";
echo          "<td><input type=\"text\" name=\"item\" size=40 value=$result[0] 
disabled> </td>";
echo          "<td><input type=\"text\" name=\"amount\" size=7 value=$result[2] 
disabled></td>";
echo          "<td><input type=\"text\" name=\"quantity[$s]\" size=7></td>";
echo          "<td><input type=\"text\" name=\"discount[$s]\" size=7></td>";
echo          "<input type=\"hidden\" name=\"part_no[$s]\" value=\"$result[0]\">";
echo          "<input type=\"hidden\" name=\"price[$s]\" value=\"$result[2]\">";
echo          "<input type=\"hidden\" name=\"salesperson_code[$s]\" 
value=$salesperson_code>";
echo          "<input type=\"hidden\" name=\"customer_code[$s]\" 
value=$customer_code>";
echo          "<input type=\"hidden\" name=\"ship_to_code[$s]\" value=$ship_to_code>";
echo          "<input type=\"hidden\" name=\"date[$s]\" value=\"$date\">";
echo          "<input type=\"hidden\" name=\"status[$s]\" value=\"0\">";

echo          "<td><input type=\"checkbox\" name=\"check[$s]\" value=\"1\"></td>";
echo    "</tr>";

}

------------------------------------------------------------------------------------------------

if u can e this is a dynamic forms with some hidden fields

all i want is to submit entries with check.

something like the web mail system where in you check item w/c
you want to save / delete / add to junk










-----Original Message-----
From: Curt Zirzow [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 27, 2003 2:09 PM
To: Php (E-mail)
Subject: Re: [PHP] dealing with arrays


* Thus wrote Ford, Mike               [LSS] ([EMAIL PROTECTED]):
> On 27 August 2003 04:22, Aris Santillan wrote:
> 
> > I Have
> > <p>Entry One
> > <input type=text name=name[]>
> > <input type=text name=tel[]>
> > <input type=checkbox name=check[] value=1>
> 
> The way to combat this is to use explicit subscripts in your form field names, like 
> so:
> 
>  <p>Entry One
>  <input type=text name=name[1]>
>  <input type=text name=tel[1]>
>  <input type=checkbox name=check[1] value=1>

I would also add some structure to avoid all the different
variables and makes looping much smoother on the processing script.

<input type=text name="elements[2][name]">
<input type=text name="elements[2][tel]">
<input type=checkbox name="elements[2][checked]" value="1">

Then:

foreach ($_REQUEST['elements'] as $id => $element) {
  
  if ($element['checked']) {
    // its checked
  } else {
    // not checked.. duh..
  }
}


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to