Re: problem in checkbox

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

 



Hi,
in form use [] after the variable name to get the selected values

eg:

html:

<input name="records[]" type="checkbox"  value="12" />
<input name="records[]" type="checkbox"  value="17" />
<input name="records[]" type="checkbox"  value="33" />
<input name="records[]" type="checkbox"  value="32" />

phpcode:

$records = isset($_POST['records'])? $_POST['records']: ''; // this will
return an array


if (count($records)>0){

$records = implode($records,','); // will result in string value of
12,17,33,32
$deletesql = 'Delete * from mytable where recordids in (' . $records .')';

}

you may need to do your validations in the above code.

hope this helps!!!

Usman AA



2009/6/23 ozgur teksin <ozgur.teksin@xxxxxxxxx>

>
>
> I agree on Joe as well. Post your non working code.
>
>
> On Sun, Jun 21, 2009 at 11:38 PM, Khizra Ali <khizra_php@xxxxxxxxx<khizra_php%40yahoo.com>>
> wrote:
>
> >
> >
> > i want to delete some records through multiple checkboxes...
> > i write a code but it is not working
> > plz give me some suggestion..
> > thank in advance.
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
>
> [Non-text portions of this message have been removed]
>
>  
>



-- 
Usman A A


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux