I am trying to pass a string in the onClick event handler function's arguments.
I am not able to pass the string to the function, but I am able to pass the number integer to the function.
PHP:
echo '<tr style="background: #D6EAF8" class="clickable-row" OnClick="DisplayEnterOrderModal('.$order["id_order"].','.$order["id_customer"].','.$order[7].','"wanted to be passed"');" value="'.$order["id_order"].'" > ';
Error:
( ! ) Parse error: syntax error, unexpected '"wanted to be passed"' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in C:\wamp32\www\EK\index.php on line 644
You can try this:
Replace '"wanted to be passed"' with "wanted to be passed". Remove extra ' ' single quotes.
Or just escape them \"wanted to be passed\"
I hope this will help you :-)
echo
echo '<tr style="background: #D6EAF8" class="clickable-row" OnClick="DisplayEnterOrderModal('.$order["id_order"].','.$order["id_customer"].','.$order[7].','."wanted to be passed"');" value="'.$order["id_order"].'" > ';
Please try this one, I think this might work.