I am a newbie to PHP, tinkering a bit in different parts of web design for the last 15 years.
I have downloaded several free sample PHP scripts to send a form to email, but can't make any of them work.
The one that I would like the best out of those is formmail from tectite.com
However when I execute the script by submitting the form from htm I get a 500 error, the error script says it is related to "PHP Parse error: syntax error, unexpected '$FM_VERS' (T_VARIABLE) in /../../wonderweeder.co.nz/formmail/formmail.php on line 1"
The full code for this line is '$FM_VERS = "9.15"; // script version'
I tried deleting the line and I don't get a 500 error any longer but the whole code of the frommail.php file gets displayed.
Any help would be appreciated

    A PHP script has to start with <?php to tell your computer that it's a PHP script. If that's missing, then the text in that file is usually just displayed.

    You aren't using the code formatting tools on this site so I'm not really sure what your first line of code actually contains. It looks to me like there's a single quote (') in it. This will cause an error because of the quotes:

    <?php
    '$FM_VERS = "9.15"; // script version'

    The output is PHP Parse error: syntax error, unexpected end of file in /path/to/file.php on line 3

    If you just have one single quote at the beginning:

    <?php
    '$FM_VERS = "9.15"; // script version

    Then you get PHP Parse error: syntax error, unexpected ''$FM_VERS = "9.15"; // script ' (T_ENCAPSED_AND_WHITESPACE) in /tmp/foo/foo.php on line 2
    If you remove that, then it works -- at least that one line of code does;

    <?php
    $FM_VERS = "9.15"; // script version

    If you are getting some other error, let us know what it is.

      Write a Reply...