On Tue, 2007-07-03 at 17:57 +0200, Jochem Maas wrote:
> Robert Cummings wrote:
>
> ...
>
> >> I'll add the CSS once I can get the form to work properly, and can
> >> figure out how to change the color with css based on a certain value
> >> stored in a database IE: $rowColor :)
> >
> > At it's simplest:
> >
> > '<td class="'.$rowColor.'">'
>
> ...
> if $rowColor is a hex based value using it as a CSS class is not really going
> to work
> that well, in such cases I would opt to use inline css:
>
> echo '<td style="background:', $rowColor, '">';
Inline CSS is as maintainable as bgcolor. if you're using inline styling
then you've missed the point.
> >> To the point of the email though, is it just as simple as typing
> >> textbox[] and I have an array from the text boxes? :)
> >
> > Yes, but only if one or more checkboxes get checked. Unchecked
> > checkboxes are not sent to the server by the browser. So you need at
>
> where did the checkboxes come from? I'm sure he was only asking about
> textboxes.
I dunno :) Guess it was so similar to checkboxes and I most often use
array syntax in form fields when working with checkboxes that I got
confused :B
> BUT: Rob is correct, and if you have a number of fields in each row (of which
> some
> might be checkboxes) you are better off adding explicit array indices to the
> field
> element names so that you can explicitly match values for a give row accross
> multiple
> arrays:
>
> <input type="text" name="text[1]"><input type="checkbox" name="chk[1]"
> value="1">
> <input type="text" name="text[2]"><input type="checkbox" name="chk[2]"
> value="1">
>
> for ($i = 1; isset($_POST['text'][$i]); $i++) {
> $text = cleanInput($_POST['text'][$i]);
> $chk = isset($_POST['chk'][$i]); // checkboxes are not sent if they
> are not checked
> }
>
> > leas one to have an array, but you can just check for existence of your
> > incoming data before attempting to access array indexes.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php