m1k3yb0y Posted April 13, 2012 Share Posted April 13, 2012 Hey guys! I know there are a lot of topics about this, but mine is a bit different. I am creating my first contact form with php and I ran across this error after twinking with the php file: Fatal error: Function name must be a string in /www/zymichost.com/m/t/l/mtlproductions/htdocs/Contact2.php on line 11 Here is what my code looks like currently: <html> <body> <?php include '/www/zymichost.com/m/t/l/mtlproductions/htdocs/header.inc.php';?> <?php include '/www/zymichost.com/m/t/l/mtlproductions/htdocs/menu.inc.php';?> <?php if ($missing || $errors) { ?> <p class="warning">You did not enter the required information. Please try again.</p> <?php }; ?> <?php ($errors); ($missing); if ($isset($_POST['send'])) { $to = 'tate.mikey@gmail.com'; $subject = 'New Feedback Received on MikeyTateLive Productions website'; } $expected = array('name', 'email', 'comments'); $required = array('name', 'comments'); ?> <div id="wrapper"> <div id="maincontent"> <h2>I am here when you need me!</h2> <p>Enter the information below and click send. Hope to hear back from you soon. =)</p> <p>*=required</p> </div> </div> <form id="feedback" method="get" action=""> <p> <label for="name">*Name:</label></br> <input name="name" id="name" type="text" class="formbox"> </p> <p> <label for="email">Email:</label></br> <input name="email" id="email" type="text" class="formbox"> </p> <p> <label for="comments">*Comments:</label></br> <textarea name="comments" id="comments" cols="60" rows="8"></textarea> </p> <p> <input name="send" id="send" type="submit" value="Send" </p> </form> <?php include '/www/zymichost.com/m/t/l/mtlproductions/htdocs/footer.inc.php';?> <?php include '/www/zymichost.com/m/t/l/mtlproductions/htdocs/processmail.inc.php';?> </body> </html> I originally had lines 9 and 10 set up like this except for the php opening and closing tags, lol: <?php $errors(); $missing(); ?> But as you can see on my full code at lines 9 and 10, I made a minor change to it and now the error comes from line 11 instead of 9 and 10. And now I could use some help with this..... Quote Link to comment https://forums.phpfreaks.com/topic/260876-fatal-error-function-name-must-be-a-string/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 13, 2012 Share Posted April 13, 2012 Variables start with $, function names do not (unless you are using variable functions.) Quote Link to comment https://forums.phpfreaks.com/topic/260876-fatal-error-function-name-must-be-a-string/#findComment-1337122 Share on other sites More sharing options...
Jessica Posted April 13, 2012 Share Posted April 13, 2012 Are you trying to echo $errors; ? Quote Link to comment https://forums.phpfreaks.com/topic/260876-fatal-error-function-name-must-be-a-string/#findComment-1337130 Share on other sites More sharing options...
m1k3yb0y Posted April 13, 2012 Author Share Posted April 13, 2012 Are you trying to echo $errors; ? The error comes from line 11. Quote Link to comment https://forums.phpfreaks.com/topic/260876-fatal-error-function-name-must-be-a-string/#findComment-1337139 Share on other sites More sharing options...
Jessica Posted April 13, 2012 Share Posted April 13, 2012 It's cool, just ignore the help we've given you, and provide a useless reply without trying to fix the error based on the advice you've been given from two people. Quote Link to comment https://forums.phpfreaks.com/topic/260876-fatal-error-function-name-must-be-a-string/#findComment-1337140 Share on other sites More sharing options...
m1k3yb0y Posted April 13, 2012 Author Share Posted April 13, 2012 It's cool, just ignore the help we've given you, and provide a useless reply without trying to fix the error based on the advice you've been given from two people. Very well. First off, I didn't try to echo $errors or $missing. Should I add a echo before them? Btw, here is line 11. It is where the actual error now comes from. <?php if ($isset($_POST['send'])) ?> Also, I made some minor adjustments to lines 9 and 10..... <?php $errors = array(); $missing = array(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/260876-fatal-error-function-name-must-be-a-string/#findComment-1337162 Share on other sites More sharing options...
Jessica Posted April 13, 2012 Share Posted April 13, 2012 What are you TRYING to do?? You did the same thing with isset(). Functions do not have $ in front, unless the $name contains the name of a function. Variables start with $, function names do not (unless you are using variable functions.) Quote Link to comment https://forums.phpfreaks.com/topic/260876-fatal-error-function-name-must-be-a-string/#findComment-1337166 Share on other sites More sharing options...
m1k3yb0y Posted April 13, 2012 Author Share Posted April 13, 2012 What are you TRYING to do?? You did the same thing with isset(). Functions do not have $ in front, unless the $name contains the name of a function. Variables start with $, function names do not (unless you are using variable functions.) Damn! I don't know why I put $ before isset! But it works now. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/260876-fatal-error-function-name-must-be-a-string/#findComment-1337172 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.