Page 1 of 1

Checkbox in datagrid

Posted: Thu Oct 29, 2009 9:15 am
by greg7
Hi, i m trying to display a field from a table as checkbox in a datagrid. I have a field named Active and has two possible values active/inactive, i tried something like the following but i get : nativecode=1064 ** You have an error in your SQL syntax. In addition i think that the major problem is that i cant pass and retrieve parameters to write a handler for them, so any help would be appreciated.

Code: Select all

 
$sql.="CONCAT('<input type=checkbox name='Active' on_click='code_template.php?param1=inactive&param2=active/>Active</a>)  
 
 
 
 
In datagrid would appear a checkbox but actually it would be a link to another page with some script and then back to original.
Thanks in advance!

Re: Checkbox in datagrid

Posted: Thu Oct 29, 2009 2:17 pm
by Christopher
You are missing a closing single-quote on the onclick=. And you need to escape quotes inside the same kind of quote.

Re: Checkbox in datagrid

Posted: Thu Oct 29, 2009 3:27 pm
by VladSun
Do not use SQL for output formatting purposes - use PHP instead.

Re: Checkbox in datagrid

Posted: Fri Oct 30, 2009 9:36 am
by greg7
Thanks for the reply, but i have to retrieve variables from table to the grid, showing field Active as checkbox, in datagrid i use i cant have field's type as checkbox in view mode, so i try the way i referred. Any proposal or hints would be helpful!