Page 1 of 1

Help with button link php/js

Posted: Wed Dec 08, 2010 2:59 pm
by TonyTormenta
Hi, I'm new in php programming, I have been working with variable scopes and declarations, not sure what's wrong on this code:

Code: Select all

echo '<INPUT TYPE="button" value="Allow Edit" onClick="parent.location='.$CFG->wwwroot.'/course/view.php?id='.$COURSE->id.'&edit=1&sesskey='.sesskey().';">';
It's sending me a js error that says ";" is mising,

I would appreciate any help on this one.

Re: Help with button link php/js

Posted: Wed Dec 08, 2010 5:37 pm
by Jonah Bron
You need to put quotes around the string in the Javascript.

Code: Select all

echo '<input type="button" value="Allow Edit" onclick="parent.location=\'' . $CFG->wwwroot . '/course/view.php?id=' . $COURSE->id . '&edit=1&sesskey=' . sesskey() . '\';">';