Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [XHTML 1.0 STRICT] Problem z formularzem
Forum PHP.pl > Forum > Po stronie przeglądarki > HTML \ XHTML
gilbo
Witam mam taką stronę (tzn jest o wiele większa, ale tu wklejam istotny kod):
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  4. <title>xXx</title>
  5. <link href="style/styl.css" rel="stylesheet" type="text/css" />
  6. </head>
  7. <div id="content">
  8. <div id="menu">
  9. <img src="images/menu/mukp.jpg" alt="" />
  10. <ul>
  11. <li><a href="index.php" class="menuLeft">Link</a></li>
  12. <li><a href="index.php" class="menuLeft">Link</a></li>
  13. <li><a href="index.php" class="menuLeft">Link</a></li>
  14. </ul>
  15. <img src="images/menu/acco.jpg" alt="" />
  16. <ul>
  17. <li><a href="index.php" class="menuLeft">Link</a></li>
  18. <li><a href="index.php" class="menuLeft">Link</a></li>
  19. </ul>
  20. <img src="images/menu/pool.jpg" alt="" />
  21. Czy podoba ci się wygląd tej strony?
  22. <form action="index.php" method="get" enctype="text/plain">
  23. <input type="hidden" name="co" value="pool" />
  24. <input type="radio" name="odp" value="tak" /> Tak<br />
  25. <input type="radio" name="odp" value="nie" /> Nie<br />
  26. <input type="submit" value="Głosuj!" />
  27. </form>
  28. </div>
  29. </div>
  30.  
  31. </body>
  32. </html>


i w Validatorze W3C wyskakują mi następujące błędy:
Cytat
This page is not Valid XHTML 1.0 Strict!

Below are the results of checking this document for XML well-formedness and validity.
Error Line 25 column 47: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.
<input type="hidden" name="co" value="pool" />

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

Error Line 26 column 46: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.
<input type="radio" name="odp" value="tak" /> Tak<br />

Error Line 26 column 48: character data is not allowed here.
<input type="radio" name="odp" value="tak" /> Tak<br />

You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes).

Error Line 26 column 56: document type does not allow element "br" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.
<input type="radio" name="odp" value="tak" /> Tak<br />

Error Line 27 column 46: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.
<input type="radio" name="odp" value="nie" /> Nie<br />

Error Line 27 column 56: document type does not allow element "br" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.
<input type="radio" name="odp" value="nie" /> Nie<br />

Error Line 28 column 40: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.
<input type="submit" value="Głosuj!" />


Co jest nie tak? Proszę o pomoc.

Pozdrawiam.
frickle
spróbuj pomiędzy <form> a </form> wtsawić jeszcze <fieldset> ... tutaj pola formularza </fieldset>

Poza tym jak nie będziesz dawał nic w alt="" w obrazkach to też się będzie czepiał.
PiotrLegnica
<input>y muszą być w kontenerach (najlepiej <fieldset>), te "Tak" i "Nie" powinny być w <label for="id pola">
Np.
  1. <form action="index.php" method="get" enctype="text/plain">
  2. <input type="hidden" name="co" value="pool" />
  3. <input type="radio" name="odp" id="odp1" value="tak" /><label for="odp1">Tak</label><br />
  4. <input type="radio" name="odp" id="odp2" value="nie" /><label for="odp2">Nie</label><br />
  5. <input type="submit" value="Głosuj!" />
  6. </form>
gilbo
Wielkie dzięki za Wasze odpowiedzi:) Pomogło.

Cytat(frickle @ 30.01.2007, 20:50:36 ) *
Poza tym jak nie będziesz dawał nic w alt="" w obrazkach to też się będzie czepiał.
Jakoś się nie czepia;)

P.S Czy zna ktoś jakąś stronę, gdzie można znaleźć takie zagwozdki XHTML'a? Bo szukałem tego wcześniej i nigdzie nie znalazłem.

Pozdrawiam:D
gekon
http://kurs.browsehappy.pl/
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.