On Fri, 7 Dec 2007 23:37:23 +0000 (UTC), "markbloomfield"
<webforumsuser@macromedia.com> wrote:
>The value that creates all the checkboxes is
$AllKeywords. This is created from
>a string in a database field.
Okay, I think I have the idea. You didn't include the
recordset code, so
I just used a couple of dummy strings here:
<?php
$row_Recordset['searchkeywords']="Blue,Green";
$row_rsAllKeywords['AllKeywords']="Red,Blue,Green,Cyan,Magenta,Yellow,Black";
$List =
explode(",",$row_Recordset['searchkeywords']);//create array
from recordset query
print $row_Recordset['searchkeywords'];
print $List;// print Array
$List2 = implode(",",$List);// create string from array $List
print $List2;// Print string created from array $List to see
value
$KeywordList = $_POST['List'];
if(is_array($KeywordList))
sort($KeywordList);
$AllKeywords = explode
(",",$row_rsAllKeywords['AllKeywords']);
sort($AllKeywords);
?>
<form action="<?php print $_SERVER['PHP_SELF'];?>"
method="post">
<?php
print "<table>\n";
foreach($AllKeywords as $value){
print "<tr><td><label><input
type=\"checkbox\"".
"name=\"List[]\" value=\"$value\"";
if(is_array($List) && in_array($value,$List))
print ' checked="checked"';
print ">$value</label></td></tr>\n";
}
print "</table>\n";
if(is_array($List))
$NewKeywordList = implode (",",$List);
?>
<input name="text" type="text" id="area" value="<?php
print $NewKeywordList;?>" size="80" />
<?php //$AllKeyWordsList = implode
(",",$SelectAllKeywords);?>
<input type="submit" name="button" id="button"
value="Submit" />
<input type="hidden" name="MM_update" value="form1" />
</form>
Gary