Board Logo

Problems implementing Tigra Calendar in php
Halfdan - 4/11/2008 at 11:48 PM

I am trying to add the Tigra Calendar in a php file.

In the <head></head> area I added

<script language="JavaScript" src="calendar2.js"></script>

Within the <form></form> area I have added the call for the calendar:

<input type="Text" name="eventdate" size="10" value="mm/dd/yyyy">
<a href="javascript:cal1.popup();"><img src="img/cal.gif" width="16" height="16" border="0" alt="Click here to pick the date"></a>


After the close </form> I have added:

</form>
<script language="JavaScript">
var cal1 = new calendar2(document.forms['myformname'].elements['eventdate']);
</script>
</body>
</html>';

However, when I try to view the uploaded page, I get only this error:

Parse error: syntax error, unexpected T_STRING in /home/ssai/www/swordswallow.org/ceibookingrequest.php on line 670

I will admit that I am not a php guru. But the original php form page has been working fine before I attempted to add the Tigra calendar, and a test of Tigra calendar in a regular .html page worked perfectly.

All I can figure is that somehow the php code does not like the code in the <script> area after the </form>. Could it be the ";" that it does not like?

Any suggestions on what I am doing wrong? How do I fix it in .php?

Thanks in advance!


tigra - 4/14/2008 at 04:52 PM

php doesn't care about what's outside of <? ?> brackets. the problem is somewhere inside the php code. you could have introduced it while copying the calendar code.


Halfdan - 4/14/2008 at 05:37 PM

I figured out what it was...

In the chunk of code just after the closing </form> was supposed to be this code:

</form>
<script language="JavaScript">
var cal1 = new calendar2(document.forms['ceibookingrequest'].elements['eventdate']);
cal1.year_scroll = true;
cal1.time_comp = false;
</script>

However, the solution was that I needed to add before single '

So the final fix that works in the php looks like this:

</form>
<script language="JavaScript">
var cal1 = new calendar2(document.forms['ceibookingrequest'].elements['eventdate']);
cal1.year_scroll = true;
cal1.time_comp = false;
</script>

Hope this might help someone else who is putting javascript inside of html inside of php!


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/