devWhiz Posted September 6, 2011 Share Posted September 6, 2011 <html> <center> <form method="post" action=""> <b>Email</b><br><input type="text" name="email"/><br> <b>Password</b><br><input type="password" name="password"/><br> <input type="submit" name="submit" value="Login"/><br> </form> <?php if(isset($_POST['submit'])){ echo echo_post($_POST['email']); function echo_post($postvar){ return $postvar; } } ?> </center> </html> the filename is index.php How come I get the undefined function echo_post on line 14? I know it is probably something simple but I am kind of new to this, if you could help me out that would be great Link to comment https://forums.phpfreaks.com/topic/246522-call-to-undefined-function/ Share on other sites More sharing options...
flappy_warbucks Posted September 6, 2011 Share Posted September 6, 2011 It looks like you're calling the function inside a conditional statement. Take the function out the conditional, and then try again. Link to comment https://forums.phpfreaks.com/topic/246522-call-to-undefined-function/#findComment-1265859 Share on other sites More sharing options...
devWhiz Posted September 6, 2011 Author Share Posted September 6, 2011 its a custom function I made myself.. function echo_post($postvar){ return $postvar; } Link to comment https://forums.phpfreaks.com/topic/246522-call-to-undefined-function/#findComment-1265860 Share on other sites More sharing options...
devWhiz Posted September 6, 2011 Author Share Posted September 6, 2011 it is still returning the fatal error Fatal error: Call to undefined function echo_post() in /home/content/96/44fxx9xxxx/html/xxxxdir/index.php on line 14 Link to comment https://forums.phpfreaks.com/topic/246522-call-to-undefined-function/#findComment-1265861 Share on other sites More sharing options...
devWhiz Posted September 6, 2011 Author Share Posted September 6, 2011 Doh! I didnt even realize that, thanks man! Thats what I get for trying to rush ey lol Link to comment https://forums.phpfreaks.com/topic/246522-call-to-undefined-function/#findComment-1265862 Share on other sites More sharing options...
flappy_warbucks Posted September 6, 2011 Share Posted September 6, 2011 The code below works <html> <center> <form method="post" action=""> <b>Email</b><br><input type="text" name="email"/><br> <b>Password</b><br><input type="password" name="password"/><br> <input type="submit" name="submit" value="Login"/><br> </form> <?php if(isset($_POST['submit'])){ echo echo_post($_POST['email']); } function echo_post($postvar){ return $postvar; } ?> </center> </html> As my suspicions where confirmed when i tried the above code my on my server. Take the function out the conditional statement. Link to comment https://forums.phpfreaks.com/topic/246522-call-to-undefined-function/#findComment-1265863 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.