Cant get this form to validate

Hi, having trouble validating this to XHTML transitional, can anyone help me out please?

<h3>Order Form</h3>

<form method="post" action="mailer.php">
    <div id="form_left">
              Your Name:<br />
   <input type="text" name="name" size="24" /><br />
   <br />
    Your Email:<br />
   <input type="text" name="email" size="24" />
  <div id="form_right">
Your Date of Birth:<br />
  <input type="text" name="dob" size="24" /><br />
  <br />
 Number:<br />
  <input type="text" name="nin" size="24" /><br />
  <br />
  <br />
    <div id="form_left2">
   option:<br />
    <select name="contact_type">
    <div id="form_right2">
   Pickup Point:<br />
    <select name="pickup">
    <option>Another Option</option>
    <option>Another Option 2</option>


   <br /><br /><br />

   Please specify the details of your order, including name &amp; quantity :<br />
   <textarea rows="10" name="message" cols="55" /></textarea>
   <br />
         <p>Please ensure that you have filled out all important information before submitting.</p>
   <input type="submit" value="Submit" name="submit" />

I know that removing the textarea close tag screws everything up. :confused:

I am getting these errors:

Validation Output: 6 Errors

  1. Error Line 93, Column 61: end tag for element “textarea” which is not open

     &lt;textarea rows="10" name="message" cols="55" /&gt;&lt;/textarea&gt;

The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

If this error occurred in a script section of your document, you should probably read this FAQ entry.

  1. Error Line 93, Column 61: Opening and ending tag mismatch: form line 37 and textarea

      &lt;textarea rows="10" name="message" cols="55" /&gt;&lt;/textarea&gt;
  2. Error Line 101, Column 7: Opening and ending tag mismatch: div line 26 and form


  3. Error Line 154, Column 6: Opening and ending tag mismatch: body line 19 and div


  4. Error Line 157, Column 7: Opening and ending tag mismatch: html line 2 and body


  5. Error Line 158: Extra content at the end of the document


That’s correct for tags like <br />, <hr />, <input />, etc, but not for <textarea>, <select>, <div> and several others :slight_smile:

That solved it!


Many thanks!

I thought I couldn’t use the old HTML closing tags due to the XHTML document type.

The only error I see in the code you posted is

<textarea rows=“10” name=“message” cols=“55” /></textarea>

Should be:

<textarea rows=“10” name=“message” cols=“55”></textarea>

That’s the situation when you’re dealing with self-closing tags on empty elements.

In HTML, <br> and <img> are perfectly okay.
XHTML though requires all tags to be closed, so requires the tags to be <br/> and <img/>
Internet Explorer has trouble with those though, so you need to use a non-standard form[1] of XHTML to stop breaking IE by adding a space, so that they look like <br /> and <img />

The good news though is that we can now serve application/xhtml+xml to Internet Explorer web browsers, and have Internet Explorer still treat it as if it were text/html

When it comes to tags that have a starting and ending tag, you you don’t need to code those differently. You can use tags that look the same for both HTML and XHTML.
<p>…</p> and <textarea>…</textarea> being just two examples.


Most helpful :cool: