christofurr Posted June 10, 2007 Share Posted June 10, 2007 Why do I get the error? <html> <body> <p> <form action="form4.php" method="post"> Full Name: <input type="text" name="name" value="<?php echo $_POST["name"]; ?>" size="35" maxlength="35" /> Email Address: <input type="text" name="email" value="<?php echo $_POST["email"]; ?>" size="35" maxlength="50" /> <input type="submit" value="Create Account" /> </form> </p> <p> Your name is <?php echo $_POST["name"]; ?>. <br /> Your email address is <?php echo $_POST["email"]; ?>. <br /> </p> <p> <?php if (!filter_input(INPUT_POST, "email", FILTER_VALIDATE_EMAIL)) { echo "Invalid email address.<br />"; } if (!ereg('([a-zA-Z0-9]+[:space:]*){3,32}', $_POST["name"])) { echo "Invalid characters in Full Name field."; } elseif (ereg('^[:space:]+', $_POST["name"])) { echo "Full Name cannot begin with a space."; } elseif (ereg('[:space:]+&', $_POST["name"])) { echo "Full Name cannot end with a space."; } else { echo "Your Full Name is " . $_POST["name"]; } ?> </p> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/54919-solved-call-to-undefined-function-filter_input/ Share on other sites More sharing options...
AndyB Posted June 10, 2007 Share Posted June 10, 2007 Why do I get the error? Like the post title says .. the function is never defined. Quote Link to comment https://forums.phpfreaks.com/topic/54919-solved-call-to-undefined-function-filter_input/#findComment-271635 Share on other sites More sharing options...
christofurr Posted June 10, 2007 Author Share Posted June 10, 2007 Explain, please. Quote Link to comment https://forums.phpfreaks.com/topic/54919-solved-call-to-undefined-function-filter_input/#findComment-271642 Share on other sites More sharing options...
AndyB Posted June 10, 2007 Share Posted June 10, 2007 Explain, please. Nowhere in the code you posted is there anything that is the actual function you're invoking ... i.e., it's undefined. Quote Link to comment https://forums.phpfreaks.com/topic/54919-solved-call-to-undefined-function-filter_input/#findComment-271646 Share on other sites More sharing options...
christofurr Posted June 10, 2007 Author Share Posted June 10, 2007 I'm still confused. What must I do in order for the code to work? Quote Link to comment https://forums.phpfreaks.com/topic/54919-solved-call-to-undefined-function-filter_input/#findComment-271654 Share on other sites More sharing options...
christofurr Posted June 10, 2007 Author Share Posted June 10, 2007 ??? Quote Link to comment https://forums.phpfreaks.com/topic/54919-solved-call-to-undefined-function-filter_input/#findComment-271682 Share on other sites More sharing options...
AndyB Posted June 10, 2007 Share Posted June 10, 2007 I'm still confused. What must I do in order for the code to work? Read any simple tutorial on functions. How can your function call possibly work when there is absolutely no code anywhere to explain what filter_input is supposed to do? Quote Link to comment https://forums.phpfreaks.com/topic/54919-solved-call-to-undefined-function-filter_input/#findComment-271733 Share on other sites More sharing options...
christofurr Posted June 11, 2007 Author Share Posted June 11, 2007 W3Schools tells me that it's a predefined function. Or did I misread? They use the function the same way I do in my code. Is this site unreliable? Quote Link to comment https://forums.phpfreaks.com/topic/54919-solved-call-to-undefined-function-filter_input/#findComment-272690 Share on other sites More sharing options...
AndyB Posted June 11, 2007 Share Posted June 11, 2007 http://ca.php.net/manual/en/function.filter-input.php I learn something new every day!! Note that it's only available as part of php5. Is that what you have on your server? Quote Link to comment https://forums.phpfreaks.com/topic/54919-solved-call-to-undefined-function-filter_input/#findComment-272726 Share on other sites More sharing options...
christofurr Posted June 12, 2007 Author Share Posted June 12, 2007 Yeah, my server supports PHP5, but I think it uses PHP4 to parse all scripts by default. I'll try naming the script with the .php5 extension. Quote Link to comment https://forums.phpfreaks.com/topic/54919-solved-call-to-undefined-function-filter_input/#findComment-272866 Share on other sites More sharing options...
christofurr Posted June 12, 2007 Author Share Posted June 12, 2007 That did it. Quote Link to comment https://forums.phpfreaks.com/topic/54919-solved-call-to-undefined-function-filter_input/#findComment-272941 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.