Checkbox in datagrid

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
greg7
Forum Commoner
Posts: 32
Joined: Tue Oct 13, 2009 7:38 am

Checkbox in datagrid

Post 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!
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Checkbox in datagrid

Post by Christopher »

You are missing a closing single-quote on the onclick=. And you need to escape quotes inside the same kind of quote.
(#10850)
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Checkbox in datagrid

Post by VladSun »

Do not use SQL for output formatting purposes - use PHP instead.
There are 10 types of people in this world, those who understand binary and those who don't
greg7
Forum Commoner
Posts: 32
Joined: Tue Oct 13, 2009 7:38 am

Re: Checkbox in datagrid

Post 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!
Post Reply