can somebody look at this and let me know what should be the appropriate syntax for the following code. This is what i want to echo to the browser <li><a href="#" onClick="makeRequest('2105', 'itemDisplay');">itemname</a></li> PHP: this is what the script is echoing: echo "<li><a href=\"#\" onClick=\"makeRequest("'" .$info1['cat_id']. "'",'itemDisplay');\">"'" .$info1['cat_name'] . "'"</a></li>" ; PHP: the php echo is giving me a parser error. i have tried other things where it displays without the parser error but i am not able to figure out how to how to echo the single quotes also after the makerequest in the functions. Your help will be appreciated.
$cat_id = $info1['cat_id']; $cat_name = $info1['cat_name']; echo "<li><a href=\"#\" onClick=\"makeRequest('$cat_id','itemDisplay');\"> $cat_name</a></li>" ; Code (markup): try that
echo "<li><a href=\"#\" onClick=\"makeRequest('{$info1['cat_id']}','itemDisplay');\">{$info1['cat_name']}</a></li>" ; PHP: