
I have two <a></a> tags which holds the onclick event and has PHP code in it. Obviously I need them to work. What those links do - switch between months. Here are the links.
<a href="javascript:void(0);" onclick="getCalendar('calendar_div','<?php echo date("Y",strtotime($date.' - 1 Month')); ?>','<?php echo date("m",strtotime($date.' - 1 Month')); ?>');"><span class="glyphicon glyphicon-chevron-left"></span></a>
<select name="month_dropdown" class="month_dropdown dropdown"><?php echo $this->getAllMonths($dateMonth); ?></select>
<select name="year_dropdown" class="year_dropdown dropdown"><?php echo $this->getYearList($dateYear); ?></select>
<a href="javascript:void(0);" onclick="getCalendar('calendar_div','<?php echo date("Y",strtotime($date.' + 1 Month')); ?>','<?php echo date("m",strtotime($date.' + 1 Month')); ?>');"><span class="glyphicon glyphicon-chevron-right"></span></a>
As you can see I have the $this-> pointer in <select></select> tags which allows it to be in use because I am using classes and there has to be the pointer there I assume. So how do I get the tags to work? When I add the $this-> pointer to the onclick event in front of getCalendar the PHP code just breaks down.
Do I have to use some other method in order to achieve what I am after?
onclickevents and vice versa; all you're doing is building some HTML, which as far as PHP is concerned is just text. So it doesn't make any difference to PHP whether the code is in anonclickelement or amarqueetag.