Error displyaing form when using PHP

krackerjax 17 Apr, 2011
I'm creating a custom form, my own HTML. It says that PHP code can be used with tags. Below is the code I have in my form:

<?php $ClientIP = $_SERVER['REMOTE_ADDR'];
$IP = "<b><font color="#FF0000">$ClientIP</b></font>";
echo $IP;
?>


When I use that code in my form I get the the following error:

Parse error: syntax error, unexpected T_ECHO in /home/public_html/administrator/components/com_chronoforms/form_actions/show_html/cfaction_show_html.php(99) : eval()'d code on line 100

This is the same exact code I have used many times over in ChronoForms v3 with no issues. Is there a certain syntax I have to use to put PHP code in one of my forms?

Thanks.
GreyHead 18 Apr, 2011
HI crackerjax,

There's a problem with the quotes in the second line; you need single quotes (or escaped double quotes) round the colour:

$IP = "<b><font color='#FF0000'>$ClientIP</b></font>";



Bob
krackerjax 18 Apr, 2011
Thanks. I really don't know how I missed that one. In the original code I had the double quotes around the color were originally escaped. Not sure how they got lost when I copy and pasted from another site. But all is working now.

Great job on the new v4. Took a little getting used to compared to using v3 for all the time I did.
This topic is locked and no more replies can be posted.