Hello everything,
I am not uderstanding what i did wrong. Everything looks good but before they submit the information it should ask to re-enter the password. Can someone help me out to understand this. Here is my code

<?php
function showForm($strMessage){
  echo "<h1>".$strMessage."</h1>";
  echo " <p>Note: fields marked with '*' are required</p>\n";
  echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">\n";
  echo "<table width=\"45%\" class=\"formtable\" cellpadding=\"3\" cellspacing=\"0\">\n";
  echo "	<tr>\n";
  echo "		<td><span id=\"rfvname\">* Name:</span></td>\n";
  echo "		<td><input type=\"text\" name=\"name\" value=\"".$_POST['name']."\" /></td>\n";
  echo "	</tr>\n";
  echo "    <tr>\n";
  echo "		<td><span id=\"rfvemail\">* E-mail:</span></td>\n";
  echo "		<td><input type=\"text\" name=\"email\" value=\"".$_POST['emial']."\" /></td>\n";
  echo "	</tr>\n";
  echo "      <tr>\n";
  echo "		<td><span id=\"rfvusername\">* Username:</span></td>\n";
  echo "		<td><input type=\"text\" name=\"username\" value=\"".$_POST['username']."\" /></td>\n";
  echo "	</tr>\n";
  echo "	<tr>\n";
  echo "		  <td><span id=\"rfvpword\">* Password:</span></td>\n";
  echo "		  <td><input type=\"password\" name=\"pword\" value=\"".$_POST['pword']."\" /><br /><span style=\"font-size:9px;\"><em>(at least 4 chars)</em></span></td>\n";
  echo "	</tr>\n";
  echo "    <tr>\n";
  echo "		<td><span id=\"rfvpword\">* Re-enter Password:</span></td>\n";
  echo "		<td><input type=\"text\" name=\"pword\" value=\"".$_POST['pword']."\" /></td>\n";
  echo "	</tr>\n";
  echo "	<tr>\n";
  echo "		   <td>&nbsp;</td>\n";
  echo "		   <td><input type=\"submit\" value=\"Submit\" class=\"btnSubmit\" id=\"btnSubmit\" name=\"submit\" /></td>\n";
  echo "	</tr>\n";
  echo "</table>\n";
  echo "</form>\n";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Contact Form</title>
    <style type="text/css">
    body{
				background-color:#EB6AA3;
				color:#000000;
				font-size:100%;
				font-family:Georgia,Verdana,"Times New Roman",sans-serif;
			}


	#container{
				background:#FFF;
				width:700px;
				margin:auto;
				padding:5px 10px 2px 10px;
				border:5px double #050833;
			}
	</style>
</head>
<body>
<div id="container">
<?php
	if (isset($_POST['submit'])){
		if (trim($_POST['name'])==""){
			$strMessage="Please enter your name!";
			showForm($strMessage);
		}
		elseif (strlen(trim($_POST['pword']))<=3){
			$strMessage="Your password must be at least 4 characters long!";
			showForm($strMessage);
		}
		else{
			$strMessage="Thank you, your information has been submitted. Below is the information you sent:";
			$strMessageBody.="Name: ".trim(stripslashes($_POST['name']))."<br />";
			$strMessageBody.="E-mail: ".trim(stripslashes($_POST['email']))."<br />";
			$strMessageBody.="UserName: ".trim(stripslashes($_POST['username']))."<br />";
			$strMessageBody.="Password: ".trim(stripslashes($_POST['pword']))."<br />";
			echo "<h1>".$strMessage."</h1>";
  			echo $strMessageBody;
		}
	}
	else{
		$strMessage= "Please fill out the form below to send your information:";
		showForm($strMessage);
	}
?>
</div>
</body>
</html>

Ok i fixed what i need I just dont understand how to do the error code for when they didnt type the info or the right info into the areas.

Member Avatar for diafol

why are you pasting post values (possibly non-existent) to the form?

Also not a good idea to echo out the cleartext password.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.