mindapolis Posted June 26, 2012 Share Posted June 26, 2012 why am I getting a undefined function error? The function contactInfo names are spelled the same, right? <?php function menu() { echo <<<HEREDOC <ul id = "navBar"> <li class = "menuChoice"><a href="homepage.php">Home</a></li> <li class = "menuChoice"><a href="benefits.php">Benefits</a></li> <li class = "menuChoice"><a href="portfolio.php">Portfolio</a></li> <li class = "menuChoice"><a href="contact.php">Contact</a> </ul> HEREDOC; } function logo() { echo <<<HEREDOC <hgroup> <h1>Site Services Unlimited</h1> </hgroup> HEREDOC; } function contactInfo() { echo <<<HEREDOC 808 Melching Drive Ossian, IN 46777 <br> (260)-273-2708 <br> <a href="mailto:mindy@siteservicesunlimited.com">Contact Us</a> HEREDOC; } ?> <?php require_once("functions.php"); ?><!DOCTYPE HTML> <html lang="en"> <head> <meta charset="utf-8"> <title>Untitled Document</title> <!--meta description --> <link rel="stylesheet" href="siteServices.css"> <!--[if It IE 9]> <script src="http://html5shiv.googlecode-.com/svn/trunk/html5.js"> </script> <![endif]--> <script type="text/javascript" language="javascript"> var slideArray = new Array() slideArray[0]= "Web Design"; slideArray[1]= "Website Maintenance"; slideArray[2]= "Article Writing"; slideArray[3]= "Internet Research"; slideArray[4]= "Blogging"; function textSlideShow() { var total_slides; total_slides=Math.floor(Math.random()*slideArray.length) document.getElementById('div_display').innerHTML=slideArray[total_slides]; setTimeout("textSlideShow()",800); } </script> </head> <body> <div id="mainContent"> <header> <?php logo(); ?> <nav> <?php menu(); ?> </nav> </header> <table id = "skills"> <tr> <td> <div id="div_display"><script type="text/javascript" language="javascript">textSlideShow();</script></div> </td> </tr> </table> <footer> <?php contactInfo(); ?> </footer> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/264827-undefined-function-error/ Share on other sites More sharing options...
kicken Posted June 26, 2012 Share Posted June 26, 2012 Look at the syntax highlight above. Your heredoc inside the logo function is not being terminated properly, so the definition for your contactInfo function is being treated as part of the string. Quote Link to comment https://forums.phpfreaks.com/topic/264827-undefined-function-error/#findComment-1357167 Share on other sites More sharing options...
mindapolis Posted June 26, 2012 Author Share Posted June 26, 2012 I'm sorry, I'm still not seeing it. in the logo function it has a paired curly brackets and there 's a semicolon with no space after the heredoc Quote Link to comment https://forums.phpfreaks.com/topic/264827-undefined-function-error/#findComment-1357202 Share on other sites More sharing options...
The Little Guy Posted June 26, 2012 Share Posted June 26, 2012 In the logo function you have extra spaces after: HEREDOC; Their can be NO white space after or before it! Quote Link to comment https://forums.phpfreaks.com/topic/264827-undefined-function-error/#findComment-1357215 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.