[thelist] Multi-Part Forms

RUST Randal RRust at COVANSYS.com
Wed Jan 15 13:43:01 CST 2003


Erik Mattheis said:

> The strategy I prefer for multi-page forms would be to
> validate builderAdd1.php at the top of builderAdd2.php,

Yes, I *could* do that, but here is why I don't want to.  I want to provide
specific error messages for each field that has an error. So I have things
like this:

<?php if(isset($_GET['add']) && checkAlphaValue($first)==false): ?>
<p>Please enter a valid first name.</p>
<?php endif; ?>
	<div>
		<label for="first">first name:</label>
		<input type="text" id="first" name="first" value="<?php
if(isset($_GET['add'])){ echo "$first"; } ?>" />
	</div>

So I'm able to display the value that the user input in case that there is
an error on the page.  Otherwise, I check all of the values and forward with
header() to the next page.  Of course, this doesn't allow me to POST or GET
variables to the next page, so I have to store them in the SESSION in order
to access them.

Follow me>

----------
Randal Rust
Covansys, Inc.
Columbus, OH



More information about the thelist mailing list