seventhwiskey Posted September 23, 2007 Share Posted September 23, 2007 I'm trying to add several lines to a Javascript portion of a php that look like this: filecal13.addDisabledDates("9-12-2007 ","9-13-2007 "); (with different dates, of course) When I echo the code to a viewable part of the page using $cname . '.addDisabledDates("' . $array[$i] . '","' . $array[$i+1] . '"); it prints correctly, but using the same code in a Javascript section of the source gives me cal14.addDisabledDates("9-12-2007 ","9-13-2007 "); on multiple lines, and of course my javascript doesn't like that. I've been screwing with it for a while now and can't seem to figure it out. Any ideas? ??? Quote Link to comment https://forums.phpfreaks.com/topic/70361-problem-generating-code-with-php-printing-to-multiple-lines/ Share on other sites More sharing options...
cooldude832 Posted September 23, 2007 Share Posted September 23, 2007 Um you don't show any php in there at all and your structure for $cname doesn't look correct at all. and you use this function addDisabledDates without showing what it does. Explain your self a bit clearer Quote Link to comment https://forums.phpfreaks.com/topic/70361-problem-generating-code-with-php-printing-to-multiple-lines/#findComment-353437 Share on other sites More sharing options...
wildteen88 Posted September 23, 2007 Share Posted September 23, 2007 prehaps use trim on the $array variables: $cname . '.addDisabledDates("' . trim($array[$i]) . '","' . trim($array[$i+1]) . '"); Quote Link to comment https://forums.phpfreaks.com/topic/70361-problem-generating-code-with-php-printing-to-multiple-lines/#findComment-353467 Share on other sites More sharing options...
seventhwiskey Posted September 23, 2007 Author Share Posted September 23, 2007 $cname is simply a variable that contains the name of the calendar (cal13 in this case) trim() worked perfect. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/70361-problem-generating-code-with-php-printing-to-multiple-lines/#findComment-353576 Share on other sites More sharing options...
darkfreaks Posted September 23, 2007 Share Posted September 23, 2007 hit topic solved thanks! Quote Link to comment https://forums.phpfreaks.com/topic/70361-problem-generating-code-with-php-printing-to-multiple-lines/#findComment-353577 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.