Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

How do i pass 2 Arrays inside a Checkbox Value

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

How do i pass 2 Arrays inside a Checkbox Value

Postby stephenrodrics » 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'
stephenrodrics
New php-forum User
New php-forum User
 
Posts: 58
Joined: Thu Mar 14, 2013 6:10 am

Re: How do i pass 2 Arrays inside a Checkbox Value

Postby landi » Thu Aug 07, 2014 6:38 am

Hi,
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).

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


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.