Jump to content

Recommended Posts

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>

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.