Hey guys, I'm just learning PHP, and I'm trying to validate a form.
The problem I'm having, is with
value=
Here is a snipit of the form code as an example:
Code:
<label>Full Name
<span class="small">First Name Last Name</span>
</label>
<input onfocus="this.value=''" type="text" value="John Smith" name="name" id="name" />
I have the value set as an example of the field, and it disappears when the user clicks the field.
But the validation tutorial I'm following is telling me to set the value as
Code:
value="<?=$varname;?>
I believe that this prevents the individual from having to re-enter their information if they forgot a field, thus triggering the validation/error message and reloading the page.
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?
Please give me an example of the correct code, as I'm still learning
Thanks!