Results 1 to 3 of 3

Thread: Help... Fatal error: Function name must be a string in E:...

  1. #1
    Join Date
    Oct 2010

    Help... Fatal error: Function name must be a string in E:...

    Hi, Im pretty new to php scripting and im confused as to why im recieving the error when trying to send mail through an online contact form:

    Fatal error: Function name must be a string in E:\Domains\a\absolutionsaxophonequartet.com\user\htdocs\formhandler.php on line 10

    the script i've written is as follows...


    /* subject and email variables */

    $emailSubject = 'Email Through Website';
    $webMaster = 'fraser@absolutionsaxophonequartet.com';

    /* Gathering Data Variables */

    $email = $_POST('youremail');
    $name = $_POST('yourname');
    $subject = $_POST('subject');
    $content = $_POST('content');

    $body = <<<EOD
    Email: $youremail <br>
    Name: $yourname <br>
    Subject: $subject <br>
    Content: $content <br>

    $headers = "From: $youremail\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success = mail($webMaster, $emailSubject, $body, $headers);

    /* Results Rendered as HTML */

    $theResults = <<<EOD
    <title>Thank You</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    body {
    background-color: #f1f1f1;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-style: normal;
    line-height: normal;
    font-weight: normal;
    color: #666666;
    text-decoration: none;

    <div align="left">Thank you for getting in touch! Your email will be answered very soon!</div>
    echo "$theResults";


    If anyone could offer any solutions id be really grateful....i know its probably something stupid but im new to this and its 5 am and i've been trying to find answers on the net for hours...

    Thanks very much!


  2. #2
    Join Date
    Aug 2004
    You are using parentheses for array keys when they should be square brackets:

    PHP Code:
    // correct:

    // wrong:
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

  3. #3
    Join Date
    Oct 2010
    fantastic thanks very much!

    I appreciate it!


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles