www.webdeveloper.com
Results 1 to 4 of 4

Thread: Need help getting a Fatal error: Function name must be a string

  1. #1
    Join Date
    Oct 2008
    Posts
    4

    Need help getting a Fatal error: Function name must be a string

    I am getting this error:

    Fatal error: Function name must be a string in /www/vndv.com/j/b/r/jbrastdesigners/htdocs/linedance/request.php on line 10





    <html>
    <head>
    <title>Request Page</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;
    }
    #formHolder {
    width: 800px;
    background-color: e1e1e1;
    }
    -->
    </style>
    </head>
    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <div id="formHolder">
    <form name="form1" method="post" action="request.php">
    <p>Tell us what you think about our web site, requested songs, our organization, or anything else that comes to mind. We welcome all of your comments and suggestions.</p>
    <p><strong>What kind of comment would you like to send?</strong></p>
    <table width="600">
    <tr>
    <td><table width="200">
    <tr>
    <td><label>
    <input type="Radio" name="comment1" value="Request" id="comment1_0"/>
    Request</label></td>
    </tr>
    <tr>
    <td><label>
    <input type="Radio" name="comment1" value="Problem" id="comment1_1"/>
    Problem
    </label></td>
    </tr>
    <tr>
    <td><label>
    <input type="Radio" name="comment1" value="Suggestion" id="comment1_2"/>
    Suggestion
    </label></td>
    </tr>
    <tr>
    <td><label>
    <input type="Radio" name="comment1" value="Praise" id="comment1_3"/>
    Praise
    </label></td>
    </tr>
    </table></td>
    </tr>
    </table>
    <p><strong>What about us do you want to comment on?</strong></p>
    <table width="600">
    <tr>
    <td width="159"><select name="select" id="select">
    <option value="Web Site">Web Site</option>
    <option value="Dances">Dances</option>
    <option value="Lessons">Lessons</option>
    <option value="(Other)">Other</option>
    </select></td>
    <td width="428"><label for="commentwhat">Other</label>
    :
    <input type="text" name="commentwhat" id="commentwhat" />
    </td>
    </tr>
    </table>
    <p><strong>Enter your comments in the space provided below:</strong></p>
    <textarea name="textcomments" id="textcomments" cols="75" rows="5"></textarea>
    <p><strong>If you are requesting information about a certain dance enter it in below:</strong></p>
    <table width="600">
    <tr>
    <td width="184"><label for="name">Name: </label></td>
    <td width="403"><label for="name"></label>
    <input name="name" type="text" id="name" size="50" />
    </td>
    </tr>
    <tr>
    <td><label for="email">Email: </label></td>
    <td><label for="email"></label>
    <input name="email" type="text" id="email" size="50" />
    </td>
    </tr>
    <tr>
    <td><label for="phone">Telephone: (if necessary)</label></td>
    <td><label for="phone"></label>
    <input name="phone" type="text" id="phone" size="50" /></td>
    </tr>
    <tr>
    <td><label for="dance">Name of Dance: (if known)</label></td>
    <td><label for="dance"></label>
    <input name="dance" type="text" id="dance" size="50" />
    </td>
    </tr>
    <tr>
    <td><label for="song">Song Title:</label></td>
    <td><label for="song"></label>
    <input name="song" type="text" id="song" size="50" />
    </td>
    </tr>
    <tr>
    <td><label for="artist">Artist: </label></td>
    <td><label for="artist"></label>
    <input name="artist" type="text" id="artist" size="50" />
    </td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
    </table>
    <table width="600">
    <tr>
    <td width="180" align="left" valign="top"><div align="left">Type:
    <select name="type" id="type" size="3" multiple="multiple">
    <option value="Line Dance">Linedance</option>
    <option value="Couple / Partner">Couples</option>
    <option value="Contra">Contra</option>
    <option value="(Other)">Other</option>
    </select>
    </div></td>
    <td width="411" align="left" valign="top"><div align="left">Level:
    <select name="level" id="level" size="3" multiple="multiple">
    <option value="Beginner">Beginner</option>
    <option value="High Beginner">HighBeg</option>
    <option value="Intermediate">Int</option>
    <option value="Advanced">Adv</option>
    </select>
    </div></td>
    </tr>
    </table>
    <label for="submit"></label>
    <input type="submit" name="Submit" id="Submit" value="Submit Comments" />
    <label for="clear"></label>
    <input type="reset" name="Clear" id="Clear" value="Clear Form" />

    </form>
    </div>
    </body>
    </html>

  2. #2
    Join Date
    Oct 2008
    Posts
    10
    It would help if you wouldn't post the html as that is not where the error is but, the php that is giving you trouble. As is says though your pry have and invalid character or a space or something in your function name. Could you please post request.php?

  3. #3
    Join Date
    Oct 2008
    Posts
    4
    sorry about that, I am new to all of this!

    <?php

    /* subject and email variables */

    $emailSubject = 'Line Dancing Feedback';
    $webMaster = 'linedancingdude@comcast.net';

    /* Gathering data variables */

    $comment1Field = $_POST('comment1');
    $selectField = $_POST('select');
    $commentwhatField = $_POST('commentwhat');
    $textcommentsField = $_POST('textcomments');
    $nameField = $_POST('name');
    $emailField = $_POST('email');
    $phoneField = $_POST('phone');
    $danceField = $_POST('dance');
    $songField = $_POST('song');
    $artistField = $_POST('artist');
    $typeField = $_POST('type');
    $levelField = $_POST('level');

    $body = <<<EOD
    <br><hr><br>
    Email: $email <br>
    Name: $name <br>
    Phone Number: $phone <br>
    Comment: $comment1 <br>
    Select: $select <br>
    Text Comments: $textcomments <br>
    Comment: $commentwhat <br>
    Artist: $artist <br>
    Song Title: $song <br>
    Dance Name: $dance <br>
    Type: $type <br>
    Level: $level <br>
    EOD;

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

    /* Results render as HTML */

    $theResults = <<<EOD
    <html>
    <head>
    <title>Linedance Lessons</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 your interest! Your email will be answered very soon!</div>
    </div>
    </html>
    EOD;
    echo "$theResults";


    ?>

  4. #4
    Join Date
    Apr 2003
    Location
    Vermont (USA)
    Posts
    343
    Here you go

    PHP Code:
    $comment1Field $_POST('comment1');
    $selectField $_POST('select');
    $commentwhatField $_POST('commentwhat');
    $textcommentsField $_POST('textcomments');
    $nameField $_POST('name');
    $emailField $_POST('email');
    $phoneField $_POST('phone');
    $danceField $_POST('dance');
    $songField $_POST('song');
    $artistField $_POST('artist');
    $typeField $_POST('type');
    $levelField $_POST('level'); 
    Should be
    PHP Code:
    $comment1Field $_POST['comment1'];
    $selectField $_POST['select'];
    $commentwhatField $_POST['commentwhat'];
    $textcommentsField $_POST['textcomments'];
    $nameField $_POST['name'];
    $emailField $_POST['email'];
    $phoneField $_POST['phone'];
    $danceField $_POST['dance'];
    $songField $_POST['song'];
    $artistField $_POST['artist'];
    $typeField $_POST['type'];
    $levelField $_POST['level']; 
    $_POST is an array not a function, access its elements with [] not ()

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