Re: Dynamic Form checking
| From: | Dan Anderson | Date: | Mon, 08 Sep 2003 17:21:01 +0000 |
| Subject: | Re: Dynamic Form checking | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162004@lists.php.net to get a copy of this message | ||
if $quantity isn't filled you get NULL or FALSE.
so you could use:
if ($_POST['variable'])
etc.
Try posting less code and more question to the list. Nobody's going to
wade through 5 pages of code to analyze it and give you an answer.
-Dan
On Mon, 2003-09-08 at 03:41, Aris Santillan wrote:
> hi
>
> this is the dynamic forms
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> for($s=0;$s<$num;$s++)
> {
> $result = mssql_fetch_array($query);
>
> $result[2] = number_format($result[2], 2);
>
>
>
> echo "<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[]\"
> size=7></td>";
> echo "<td><input type=\"text\" name=\"discount[]\"
> size=7 value=\"0\"></td>";
> echo "<input type=\"hidden\" name=\"part_no[]\"
> value=\"$result[0]\">";
> echo "<input type=\"hidden\" name=\"price[]\"
> value=\"$result[2]\">";
> echo "<input type=\"hidden\" name=\"salesperson_code[]\"
> value=$salesperson_code>";
> echo "<input type=\"hidden\" name=\"customer_code[]\"
> value=$customer_code>";
> echo "<input type=\"hidden\" name=\"ship_to_code[]\"
> value=$ship_to_code>";
> echo "<input type=\"hidden\" name=\"date[]\"
> value=\"$date\">";
> echo "<input type=\"hidden\" name=\"status[]\"
> value=\"0\">";
>
> echo "<td><input type=\"checkbox\" name=\"check[]\"
> value=\"$s\"></td>";
> echo "</tr>";
>
>
> }
>
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> this the code that will get items that are checked
>
>
> foreach($check as $checkitem)
> {
>
>
>
> echo $quantity[$checkitem] . " " . $discount[$checkitem] . " " .
> $part_no[$checkitem] . " " . $price[$checkitem] . " " .
> $salesperson_code[$checkitem] . " " . $customer_code[$checkitem] . " " .
> $ship_to_code[$checkitem] . " " . " " . $status[$checkitem] . " " .
> $date[$checkitem] . "<br>";
>
>
> }
>
>
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>
> the problems / situation
>
>
> how can i check or validate
>
> it should be. if someone filled up the $quantity[] field, she / he must check the $check[]
> field or if a use check the $check[] field
> he must put something on the $quantity[] field. and
>
> otherwise empty $quantity[] field and empty $check[] field is allowed,
>
>
>
>
>
>
> thanks in advance
>
>
>
>
>
>
>
>
>
>