How do i pass 2 Arrays inside a Checkbox Value

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 64
Joined: Thu Mar 14, 2013 6:10 am

Thu Aug 07, 2014 5:16 am

I have a table inside that I want to pass empid and week array inside Value data

I am able to get the proper data, but week should come in single Quotes how do i do that

<td width = 7%> <input type ='checkbox' id = 'Approve' value = '$json_empid[$i] and week = $json_week[$i]' name = 'Music' onclick='')'>Approve</td>

current output getting is

empid = 100 and week = 2014-05-01

I need date inside single quote

empid = 100 and week = '2014-05-01'

php-forum Active User
php-forum Active User
Posts: 388
Joined: Thu Mar 15, 2012 3:59 pm

Thu Aug 07, 2014 6:38 am

Use double quotes outside and add single quotes inside. (Also note: html requires quotes arround the 7%):

Code: Select all

<td width = "7%"> <input type ='checkbox' id = 'Approve' value = "$json_empid[$i] and week = '$json_week[$i]' " name = 'Music' onclick='')'>Approve</td>
However, maybe you haven't shown us the real problem since IHMO your example shouldn't have worked ('$var' does not expand $var, but "$var" does).


Post Reply