Help with button link php/js

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TonyTormenta
Forum Newbie
Posts: 1
Joined: Wed Dec 08, 2010 2:50 pm

Help with button link php/js

Post 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.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Help with button link php/js

Post 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() . '\';">';
Post Reply