Re: Field Validation Question
Posted: Wed Mar 07, 2012 12:37 pm
Oh, I see. That's normal behaviour because you're just echoing it out. Instead, assign it to a variable and echo that variable (when it exists) somewhere inside the HTML.
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<!DOCTYPE html>
<html>
<body>
<div class="header"><head>
<a><IMG SRC="/schedule/images/banner3.jpg" ALT="" WIDTH=98% HEIGHT=120"></a>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Contact Form</title>
</head></div>
<form action="" method="post">
<div class="borderbx">
<h1 style="text-align:left; padding-left:50px;"><i>Register Here .... </i></h1>
</div>
<table align="left" style = "width=25%; margin-left: 30px;">
<tr>
<td align="right">
<label for="fname">First Name</label>
</td>
<td align="left">
<input tabindex="1" type="text" name="fname" />
</td>
<td align="right">
<label for="password">Password</label>
</td>
<td align="left">
<input tabindex="4" type = "password" name="password" />
</td>
</tr>
<tr>
<td align="right">
<label for="lname">Last Name</label>
</td>
<td align="left">
<input tabindex="2" type="text" name="lname" />
</td>
<td align="right">
<label for="password2">Verify Password</label>
</td>
<td align="left">
<input tabindex="5" type = "password" name="password2" />
</td>
</tr>
<tr>
<td align="right">
<label for="email">Email Address</label>
</td>
<td align="left">
<input tabindex="3" type="email" name="email" />
</td>
<td align="right">
<input style="font-weight:bold;" tabindex="6"type="submit" value="Submit" />
</td>
</tr>
<tr>
<td></td> <!-- This block was added simply as a spacer. Without this spacer, the error text in the next block throws the entire table out of alignment. -->
<td align="left"> <!-- This block of code/script does the error reporting. Nothing is vislbe until there is an error. -->
<?php if (isset($errors['fname'])): ?>
<span class="error"><?php echo $errors['fname']; ?><br /></span>
<?php endif; // See an explanation of this coding at devnetwork.net forums - topic "Field Validation Question": http://forums.devnetwork.net/viewtopic.php?p=672372#p672372?
<?php if (isset($errors['password'])): ?>
<span class="error"><?php echo $errors['password'];?><br /></span>
<?php endif; ?>
<?php if (isset($errors['lname'])): ?>
<span class="error"><?php echo $errors['lname']; ?><br /></span>
<?php endif; ?>
<?php if (isset($errors['password2'])): ?>
<span class="error"><?php echo $errors['password2'];?><br /></span>
<?php endif;?>
<?php if (isset($errors['email'])): ?>
<span class="error"><?php echo $errors['email'];?><br /></span>
<?php endif; ?>
</td></tr>
</table>
<div class="borderbx" style="margin-top: 25%; margin-left: 30px; margin-right: 50%">
<p style="text-align: center;"><?php echo $confirmation; ?></p></div>
</form>
</body>
</html>
Have you tried the HTML/CSS forum right here?Pavilion wrote:I know this is a php forum, so html/css questions are out of scope. I did try posting my questions on other forums - geared more towards html/css. But the guidance wasn't adequate. If you know of a good html/css forum, please refer me.
Celauran wrote:Have you tried the HTML/CSS forum right here?Pavilion wrote:I know this is a php forum, so html/css questions are out of scope. I did try posting my questions on other forums - geared more towards html/css. But the guidance wasn't adequate. If you know of a good html/css forum, please refer me.