|
Posted by Jeff on 01/20/07 00:00
Hey
I'm trying to develop a portal using php 5.2.0. In one of the web pages the
users can create their own profile. In the Form I've placed the id of the
current profile id (when the user submits the form the form checks if the
hidden field has a value, if no value is present then execute a insert
statement against db, else, execute update statement).
I 've got some problems (the problem is that if the user submit a form more
than 2 times, the form start to execute insert statement - inserting new row
in table, but instead it should update) with this hidden field. I'm not sure
what I'm doing wrong here... I thought to begin with it's a good idea to
make the page containing the form to be 100% xhtml compliant. (I use the
xhtml validator at w3.org)
Based on the validation error (see below) I get on the hidden field, maybe
some of you could give me tips on how to solve this validation error???
************************ here is the php code generating the hidden
**********************
<?php
echo "<input type='hidden' name='property' value='4' />";
?>
************************ here is the form part of the web page
**********************
<form action="index.php?mode=profile&style=add&opt=1" method="post"
>
<table style="width:100%;" cellpadding="3" cellspacing="0" >
<tr>
<td align="right" style="width:40%;"><label
for="field1">field1:</label></td>
<td align="left" style="width:60%;">
<input type='text' name='field1' id='field1' value = '' /> </td>
</tr>
<tr>
<td align="right" style="width:40%;"><label
for="field2">field2</label></td>
<td align="left" style="width:60%;">
<input type='text' name='field2' id='field2' value = '' />
</td>
</tr>
<tr><td colspan='2'></td></tr> <tr>
<td colspan="2" align="center" style="padding-top:20px;">
<a href="javascript:submitForm()">Lagre</a>
</td>
</tr>
</table>
<input type='hidden' name='property' value='4' />
</form>
************ here is the result from the check at w3.org
*************************
Below are the results of checking this document for XML well-formedness and
validity.
1.. Error Line 121 column 49: 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='property' value='4' /></form>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>").
Navigation:
[Reply to this message]
|