"Sundogcurt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi guys, like every other problem I have this one is SURE to be
> painfully simple to fix and make me look g0ofy again.
>
> I have an edit user form with checkboxes like the one below :
>
> <INPUT type="checkbox" value="Boating" name="Activity[]"
> <?docheck("Boating")?>>
>
> When the form loads I grab the users relevant information and display
> it, I am having trouble checking checkboxes that should be checked
> though. Here is how I am attempting to do it.
>
> Prior to the form loading I load an array with the required checkbox
> VALUES, not names, I did it this way because I reference the checkbox
> values as an array to write to a database.
>
> As the form loads I call a function "docheck()" and pass $inputvalue
> (the value of the checkbox) compare the values pulled from the database
> and if there is a match, I write "CHECKED" to indicate that the user had
> previously chosen this.
>
> The function is below :
>
*****************
right here......
u need to pass that array of activity to the function too.... its not
global.
> function docheck($inputvalue){
> $flag = 0;
> $tempcnt = 0;
> $temptotal = count($editActivity);
> while($tempcnt != $temptotal){
> if($inputvalue == $editActivity[$tempcnt]){
> $flag = 1;
> }
> $tempcnt++;
> }
> if($flag == 1){
> print "CHECKED";
> }
> }
>
> The problem seems to be that a "match" never occurs, I tried passing
> "Boating" and re-wrote the function as such...
>
> $flag = 0;
> if($inputvalue == 'Boating'){
> $flag = 1;
> }
> if($flag == 1){
> print "CHECKED";
> }
>
>
> and it worked just fine, so I am of a mind that I am doing something
> wrong while attempting to match my passed value with the values in my
> array.
>
> Please help!
>
> --
> Curtis Gordon
> Groovy Web Developer
> xxxx 168th Street
> White Rock
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php