Jump to content

[SOLVED] got one hell of a mystifying problem here


farban

Recommended Posts

well im sorry if i have posted it in the wrong section but this is mostly php in html so here goes

 

<div class="admindiv">
<?php

if(!isset($_POST[styleoption])) {
if($_COOKIE['style'] == "matt") {
	$style1 = "CHECKED";
} elseif($_COOKIE['style'] == "mattgrey") {
	$style2 = "CHECKED";
}

if($_GET[reply] == 1) {
	echo "Style changed";
}


echo "<form method='post' action='template.php?page=admincss'/>";
echo "<input type='radio' name='styleoption' value='matt' $style1/>";
echo " - Matts Style";

echo "<input type='radio' name='styleoption' value='mattgrey' $style2/>";
echo " - Matts Grey Style";

echo "<div><input type='submit' value='Change'/></form></div>";
} else {
SetCookie("style", $_POST['styleoption'], time()+31536000);
echo "<script>self.location='template.php?page=admincss&reply=1'</script>";
}


?>
</div>

 

and i validate the page in xhtml strict and i get this messege:

 

 

 

#  Error  Line 96, Column 250: end tag for element "form" which is not open.

… type='submit' value='Change'/></form></div></div>

✉

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.
# Error Line 96, Column > 80: XML Parsing Error: Opening and ending tag mismatch: div line 96 and form.

…ge=admincss'/><input type='radio' name='styleoption' value='matt' /> - Matts …

✉
# Error Line 119, Column 6: XML Parsing Error: Opening and ending tag mismatch: body line 24 and div.

</div>

✉
# Error Line 121, Column 7: XML Parsing Error: Opening and ending tag mismatch: html line 6 and body

 

its for a college project and it has to be validated in xhtml strict....i been looking over and over the code and im not familar with changing the forms to make them xhtml strict

 

please any help people would be most appreciated

Link to comment
Share on other sites

Remove the "/>" from the end of the form tag.

Elements that have "/>" at the end close themselves such as images, input fields, links.

 

e.g.

 

<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<img src="image.png" border="0" alt="My Image" title="My Image" />
<input type="text" name="username" id="username" />

Link to comment
Share on other sites

How is this thread any different from the other one you posted earlier asking for pretty much the same help?  I'm going to assume since your other thread was marked as solved, that this is a different problem, but it's the same kind of problem.  I'm moving it to where I moved your other one, I have noted your apology for posting in the wrong place, but come on, we've already been through this...

Link to comment
Share on other sites

when i remove the slashs / like you say it comes up with more errors which is strange it says things like

 

Line 96, Column 109: 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.

…dio' name='styleoption' value='matt' > - Matts Style<input type='radio' name=

✉

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>").

 

im just really unsure of how to approuch this

Link to comment
Share on other sites

Posting the php code that results in an html page that has validation errors isn't really helpful.

 

Posting html code with validation errors makes more sense because then we can SEE the code that doesn't validate.  By the way, the whole code is needed, not just a few lines here and there.

 

There's usually no mystery to this once you study the generated code and look at the validation errors that are displayed.

Link to comment
Share on other sites

In this case, the validator tells you exactly what you need to know to solve your problem:

 

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.

 

If you are validating with XHTML strict, inputs must be inside a div or a p or a fieldset or something. The list is in the quote above. If the input isn't inside one of these, then your code wont validate.

Link to comment
Share on other sites

i just want to say that the problem is now fixed after some mircle work hehe. i looked at a previous form that validated to xhtml strict and then copied it to the form i was having problems with

 

the form that validated in my pervious project

 

<form action="" id="myform" >
<div id="container">

<div id="row1">
  <div id="column1">First Name</div>
  <div id="column2"><input type="text" id="FirstName"/></div>
</div>
<div id="row2">
  <div id="column3">Last Name</div>
  <div id="column4"><input type="text" id="LastName"/></div>
</div>
<div id="row3">
  <div id="column5">Email</div>
  <div id="column6"><input type="text" id="Email"/></div>
</div>
<div id="row4">
  <div id="column7">Phone</div>
  <div id="column8"><input type="text" id="Phone"/></div>
</div>
<div id="row5">
  <div id="column9">Feedback</div>
  <div id="column10"><textarea cols="70" rows="9" name="Address"></textarea></div>
</div>
<div id="row6">
  <div id="column11">Country</div>
  <div id="column12">
  <select name="Country">
<option value=""> Select your nation</option>
<option value="008"> Albania</option>
<option value="012"> Algeria</option>
<option value="016"> American Samoa</option>
<option value="020"> Andorra</option>
<option value="024"> Angola</option>
<option value="660"> Anguilla</option>
<option value="010"> Antarctica</option>
<option value="028"> Antigua And Barbuda</option>
<option value="032"> Argentina</option>
<option value="051"> Armenia</option>
<option value="533"> Aruba</option>
</select>
</div>
</div>
<div id="row7">
  <div id="column13"></div>
  <div id="column14"><input type="submit" value="Submit"/></div>
</div>
</div>
</form>

 

this is the new form with the changes

 

echo "<form action='template.php?page=admincss' id='styleoption' method='post'>";
echo "<div class='wrap'>
	<div class='row1'>
	<div class='column1'><input type='radio' name='styleoption' value='matt' $style1/>";
echo "Matts Style</div>
	</div>";

echo "<div class='row2'>
	<div id='column3'><input type='radio' name='styleoption' value='mattgrey' $style2/>";
echo " Matts Grey Style</div>";

echo "<div id='column5'><input type='submit' value='Change'/></div>
</div>
</div>
</form>";

 

it validates to xhtml strict perfectly so if this helps anyone thats cool

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.