doforumda Posted April 10, 2009 Share Posted April 10, 2009 hi i want to embed javascript in php code how can i embed the javascript in the following code echo "<tr> <td>".$record['statVal_id']."</td> <td>".$record['firstname']."</td> <td>".$record['lastname']."</td> <td>".$record['region']."</td> <td><input type = 'button' name = 'edit1' value = 'Edit' onclick='javascript(go2Page(".$record['statVal_id']."));></td> </tr>"; Link to comment https://forums.phpfreaks.com/topic/153455-need-help-about-embedding-javascript-into-php/ Share on other sites More sharing options...
jackpf Posted April 10, 2009 Share Posted April 10, 2009 You don't need to put javascript() as onclick is a javascript event, so it's handled by javascript anyway. And by doiing that you're calling a javascript function go2page(). What is it that you want to do exactly? Link to comment https://forums.phpfreaks.com/topic/153455-need-help-about-embedding-javascript-into-php/#findComment-806227 Share on other sites More sharing options...
doforumda Posted April 10, 2009 Author Share Posted April 10, 2009 i created a function using javascript i am calling that function Link to comment https://forums.phpfreaks.com/topic/153455-need-help-about-embedding-javascript-into-php/#findComment-806228 Share on other sites More sharing options...
doforumda Posted April 10, 2009 Author Share Posted April 10, 2009 i created a function using javascript i am calling that function tell me how can i use quotes etc to embed into php Link to comment https://forums.phpfreaks.com/topic/153455-need-help-about-embedding-javascript-into-php/#findComment-806230 Share on other sites More sharing options...
doforumda Posted April 10, 2009 Author Share Posted April 10, 2009 anyone who can solve my problem Link to comment https://forums.phpfreaks.com/topic/153455-need-help-about-embedding-javascript-into-php/#findComment-806320 Share on other sites More sharing options...
Axeia Posted April 10, 2009 Share Posted April 10, 2009 I'm guessing you're having problems with the quotes in this bit? 'javascript(go2Page(".$record['statVal_id'].") Use backslashes like this, 'javascript(go2Page(".$record[\'statVal_id\'].") It's explained on http://php.net/types.string Link to comment https://forums.phpfreaks.com/topic/153455-need-help-about-embedding-javascript-into-php/#findComment-806321 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.