Re: task Scheduler driving me crazy!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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, '">';

> 
> 
>> 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.

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.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux