<?php
if (isset($_POST['name']))
{
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$errorstring = "";
if (!$name)
$errorstring = $errorstring."Name<br>";
if (!$email)
$errorstring = $errorstring."Email<br>";
if (!$message)
$errorstring = $errorstring."Message<br>";
echo "The length of message is ".strlen($message);
echo "<br>";
if ($errorstring!="")
echo "Please fill out the following fields:<br> $errorstring";
else
{
echo "Success!";
echo "<form action='formvalidation.php' method='POST'>";
echo "</form>";
}
}
?>
<form action="formvalidation.php" method='POST'>
Name: <input type='text' name='name' value='<?php echo $name; ?>'> <br>
Email: <input type='text' name='email' > <br>
Message: <textarea name='message' rows='5' cols='40'> <?php echo $message; ?> </textarea> <br>
<input type="submit" name="click" value='Send'> <br>
</form>
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.