Processing a form with PHP
That method is fine, and is the one I use. As for a better way? I don't know, seems just fine to me. However, there are some other things that could be improved with this script, and that may be why you feel there might be a better way.

For one, that's some really messy HTML... I would try and separate your PHP from your HTML as much as possible. This is a little harder to do when not using MVC, but can still be accomplished by abstracting your larger bits of code. Also, you are using PHP short tags, but then not using PHP template syntax, this seems counter productive. The purpose of the short tags is to make your code cleaner and make it non-PHP user friendly. Of course, I'm not endorsing PHP short tags, I think you should avoid them, as you are not always guaranteed to have a server that will support them. Lastly, your code is pretty repetitive, the best thing for repetitive stuff like this is loops. For example, here's a sample of how my version of this form would look.

&lt;?php
$fields = array(
    'name',
    'age',
    //etc...
);
?&gt;

&lt;?php foreach( $fields AS $field ) : ?&gt;

&lt;?php $value = isset( $_SESSION[ 'form' ] [ $field ] ) ? $_SESSION[ 'form' ] [ $field ] : ''; ?&gt;

&lt;label for="&lt;?php echo $field; ?&gt;"&gt;What is your &lt;?php echo $field; ?&gt;?&lt;/label&gt;
&lt;input type="text" name="&lt;?php echo $field; ?&gt;" value="&lt;?php echo $value; ?&gt;" maxlength="60" /&gt;

&lt;?php if( ! isset( $_SESSION[ 'errors' ] [ $field ] ) ) : ?&gt;

&lt;label class="error" for="&lt;?php echo $field; ?&gt;"&gt;&lt;?php echo $_SESSION[ 'errors' ] [ $field ]; ?&gt;&lt;/label&gt;

&lt;?php endif; ?&gt;

&lt;?php endforeach; ?&gt;


Of course, even this seems really messy to me, though I can't think of much more, besides using MVC, to do to this to make it cleaner. Also, notice I removed the "id" attribute from your input tag. When your tag has a name, it doesn't need an id, you can just call it with the name. Example:

alert( document.form.name.value );//may not work, dont think "form" is valid name


Take a look at PHP's filter_input() function. Its available as long as your PHP version is >= 5.2. It also has some validation flags if you're interested.

$form[ 'name' ] = filter_input( INPUT_POST, 'name', FILTER_SANITIZE_STRING );


Keep in mind the "Don't Repeat Yourself" (DRY) principle. There are a lot of violations of it here. I demonstrated how to avoid it with your form above, you can do something similar for the processing script.