www.webdeveloper.com
Results 1 to 4 of 4

Thread: Fatal error: Function name must be a string

  1. #1
    Join Date
    Feb 2013
    Posts
    9

    Fatal error: Function name must be a string

    Ive just designed my first contact form for my website so people can sign up to sell tickets to the event but I get this error

    Fatal error: Function name must be a string in /home/insomnia/public_html/contactformprocess.php on line 10

    I don't understand why I am getting this error

    here is the PHP code

    <?php

    /* Subject and Email Variables */

    $emailSubject = 'Insomnia All Ages Promoters';
    $webMaster = 'aaron@superbsoundentertainment.com';

    /* Gathering Data Variables */

    $nameField = $_POST('name');
    $emailField = $_POST('email');
    $mobileField = $_POST('mobile');
    $schoolField = $_POST('school');
    $dobField = $_POST('dob');
    $addressField = $_POST('address');
    $whyField = $_POST('why');

    $body = <<<EOD
    <br><hr><br>
    Name: $name <br>
    Email: $email <br>
    Mobile: $mobile <br>
    School: $school <br>
    DOB: $dob <br>
    Address: $address <br>
    Why: $why <br>
    EOD;

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

    /* Results rendered as HTML */

    $theResults = <<<EOD
    <html>
    <head>
    <title>JakesWorks - travel made easy-Homepage</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;
    }
    -->
    </style>
    </head>

    <div>
    <div align="left">Thank you for signing up! We will be in touch very soon! Kind regards the team at Superb Sound Entertainment</div>
    </div>
    </body>
    </html>
    EOD;
    echo "theResults";


    ?>

    Also here is a link to the website insomniau18s.com

    Please Help

    Kind Regards
    Aaron

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,430
    Wherever you are referencing elements of the $_POST array (or any other array), you need to use ['square_brackets'] instead of ('parentheses') where you specify the array key/index. Parentheses are used when calling functions to enclose the argument lists (and also when defining functions).
    "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

    eBookworm.us

  3. #3
    Join Date
    Feb 2013
    Posts
    9
    I honestly have no idea what that means i get the first part i have to change all the $_POST from ( to [ but what do you mean by where you specify the array key/index. Parentheses are used when calling functions to enclose the argument lists (and also when defining functions).

  4. #4
    Join Date
    Feb 2013
    Posts
    9
    I changed the post ones to [ and it said success but then i checked my emails but none of the information was gathered it just had Name: and all the other headings but no information

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