OK. I am a noob first off but I know enough PHP to be dangerous. I am trying to learn OpenCart's layout. I am trying to create a button that will simply Delete data from a table in the database. I have the button displaying fine and I call it with a <a onclick="mynewfunction();">My Button</a> I added mynewfunction() to the model file that performs the action on the table and field in the database but I am getting an unexpected T_PUBLIC" error when I add the function. Can someone give me a brief explanation of how buttons work in OpenCart? Just a real simple example would be excellent.
thanks all.
well first you are adding a javascript tag and expecting it to fire a php function? That won't happen unless you have the ajax code to bridge the gap.
Unexpected T_PUBLIC means you tried to add a public function to a php file but not in the right place. If you are inside of a class you can use "public function blah()" but if you are outside a class you just use "function blah()"
Unexpected T_PUBLIC means you tried to add a public function to a php file but not in the right place. If you are inside of a class you can use "public function blah()" but if you are outside a class you just use "function blah()"
Thanks Qphoria, I understand. Appreciate it.Qphoria wrote:well first you are adding a javascript tag and expecting it to fire a php function? That won't happen unless you have the ajax code to bridge the gap.
Unexpected T_PUBLIC means you tried to add a public function to a php file but not in the right place. If you are inside of a class you can use "public function blah()" but if you are outside a class you just use "function blah()"
Who is online
Users browsing this forum: No registered users and 123 guests