The FORM tag is fine, you want a form tag if you have INPUTS -- the problem is in your script.
Would point at the first from on the page... but trying to count by number makes it a pain should you add another form on the page before it (like a search)... and the sub-elements array is likewise... hindered. It's just too fragile which is why I'd use the unique ID on each input (which every ID should be unique, no re-using those!) as the target.
To fix your script, you need to take every place that you call this type of construct:
and replace it with
Where the value in quotes inside the getElementById method is the ID of the input you want to check. Since you only have 9 of them that's not a giant change.
Even if ["order"]["lastname"] was valid and actually ran, it would still fail -- in your HTML id="lname" is set to name="textfield" -- as is every other input there.. the 'lastname' target doesn't even exist!