How can I have the 'example' of the field and the var so that people don't have to re-enter their information when the form is validated?
I don't understand that sentence.
<input type="text" value="<?php echo $varname; ?>" name="name" id="name" placeholder="John Smith" />
If you are using the HTML5 doctype then you don't need ' /' at the end either.
It is also advisable to always use the full php opening tag <?php
and echo the value.
You'll notice that if you delete the value and click away from the input the placeholder text will show. However, placeholder text should say something useful such as "Name is required" or "Minimum 5 characters" rather than an actual name, as this is mis-leading.
BTW I think name
is a very poor name
for the name. Use a little imagination; even 'fullname' is better.