Jump to content

empty fields

Go to solution Solved by raphael75,

Recommended Posts

<h2>Scholarship Form</h2>
<form name="scholarship" action="process_Scholarship.php" method="post">
	<p>First Name: <input type="text" name="fname" /></p>
	<p>Last Name: <input type="text" name="lname" /></p>
	<p><input type="reset" value="Clear Form" />  <input type="submit" value="Send Form" /></p>
ini_set('display_errors', 'on');

$firstName = validateInput($_POST['fname'], "First Name");
$lastName = validateInput($_POST['lname'], "Last Name");
if ($errorCount<0)
	echo "Please use the \"Back\" button to re-enter data.<br />\n";
	echo "<p>Thank you for filling out the scholarship form, ".$firstName." ".$lastName.".";

function displayRequired($fieldName) {
	echo "The field \"$fieldName\" is required.<br />\n";
function validateInput($data, $fieldName) {
	global $errorCount;
	if (empty($date)) {
		$retval = "";
	} else {//Only clean up the input if it isn't empty
		$retval = trim($data);
		$retval = stripslashes($retval);
$errorCount = 0;


it always reads the form as empty, and spits out the error message. why will it not read the names I enter?

Link to comment
Share on other sites

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.

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.