Hello all,
Please help me to do the following. I try to search PHPBuilder.com, but I can't find what I need. Ok, here it is.
I have the following form:
<?php
echo '<form action="'.htmlspecialchars($_SERVER['PHP_SELF']).'" method="post">';
for($i=1; $i<6; $i++)
{
echo ' '.$i.': <input type="hidden" name="id" value="'.$i.'">';
echo 'Last name: <input type="text" name="lastname[]"> ';
echo 'First Name:<input type="text" name="firtname[]"><br>';
}
echo '<input type="submit" name="submit" value="Enter">
</form>");
?>
So, I have the following:
- I have a form that take in 5 last names and 5 first names, also has id assigned to each first adn last name.
- I am trying to pass it to the same page.
What I am trying to do:
1. I need a way to preserve the data on this form, if the user enter a last name and forgot to enter a first name. It will then display errors and ask the user to enter the first name. BUT, I need to preserve the data for the rest of the form.
2. Insert id, last name, first name accordingly (correctly). Example, id1, lastname1, firstname1... and so on.
I hope that my questions make sense. Thanks in advance.
Proteus