/    Sign up×
Community /Pin to ProfileBookmark

Form Issues :(

Ok, here’s the problem:

I am having validation issues with my page. Here’s the code:

[code=php]
echo “<form action=”index.php?section=category&amp;subsection=process-add” method=”post”>”;
echo “<label for=”name”>Name (max 30 char)</label>”;
echo “<input type=”text” name=”name” size=”25″ maxlength=”30″ />”;
echo “<br />”;
echo “<label for=”description”>Description (max 255 char)</label>”;
echo “<input type=”text” name=”description” size=”40″ maxlength=”255″ />”;
echo “</div>”;

echo “</div>”;

echo “<div class=”standard_box” id=”attributes” style=”width: 149px; float: left; margin-bottom: 5px;”>”;

$parent_cat_query = “SELECT `name` FROM `cobalt_categories` ORDER BY `name` ASC”;
$parent_cat_result = mysql_query($parent_cat_query);

echo “<h3><img src=”../images/cobalt_categories_attributes.png” alt=”Attributes” /></h3>”;
echo “<h4>ID#:&nbsp;$newid&nbsp;-&nbsp;” . date(“m.d.y”, time() – 3600) . “</h4>”;

echo “<select>”;
echo “<option>Parent Category…</option>”;
while ($cat = mysql_fetch_array($parent_cat_result))
{
echo “<option value=”” . stripslashes($cat[‘name’]) . “”>”;
echo(stripslashes($cat[‘name’]));
echo “</option>”;
}
echo “</select>”;

echo “<br />”;
echo “<h4>Active</h4>”;
echo “<input type=”checkbox” checked=”checked” style=”border: 0;” />”;

echo “</div>”;
echo “<div style=”text-align: right; margin-right: 1px;”>”;
echo “<input type=”submit” value=”submit” />&nbsp;”;
echo “<input type=”reset” value=”reset” />”;

echo “</div>”;

echo “</form>”;
[/code]

The errors I get are these:

“line 40 column 1751 – error: discarding unexpected </form>”
“line 40 column 413 – warning: missing </form>”

Anyone have any ideas what is going on with this?

Thanks, guys,
Will

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsNov 18.2005 — What's with the insane spacing?
Copy linkTweet thisAlerts:
@tgrk35authorNov 18.2005 — What's with the insane spacing?[/QUOTE]

In the source? Yeah, I have it tabbed and it screws it up when I post it on here ?. Sorry about that.

If you're wondering about the crazy spacing on the site itself, it's just an IE thing that I haven't fixed yet ?.
Copy linkTweet thisAlerts:
@SpectreReturnsNov 18.2005 — Where are these errors being spawned from?
Copy linkTweet thisAlerts:
@tgrk35authorNov 18.2005 — I have the validator extension in firefox so I just view the source :-$.

Here's what the actual w3c validator says:

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.summel.net%2Fcobalt%2Fadmin%2Findex.php%3Fsection%3Dcategory%26subsection%3Dadd&charset=%28detect+automatically%29&doctype=Inline[/QUOTE]
Copy linkTweet thisAlerts:
@SpectreReturnsNov 18.2005 — Your problem is that you're closing the tags in the wrong order. You close two divs from inside the form, but they aren't open at this level.
Copy linkTweet thisAlerts:
@tgrk35authorNov 18.2005 — What should I do to fix it :-$? I'm sorta confused still ?
Copy linkTweet thisAlerts:
@tgrk35authorNov 18.2005 — Ok, so I moved the opening <form> up before two <div>'s...

It seems to be fine now...

What causes this problem?
Copy linkTweet thisAlerts:
@SpectreReturnsNov 18.2005 — 
[color=red]echo "<form action="index.php?section=category&amp;subsection=process-add" method="post">";[/color]

echo "<label for="name">Name (max 30 char)</label>";

echo "<input type="text" name="name" size="25" maxlength="30" />";

echo "<br />";

echo "<label for="description">Description (max 255 char)</label>";

echo "<input type="text" name="description" size="40" maxlength="255" />";

[color=red]echo "</div>";



echo "</div>";[/color]

[/quote]


See, you're opening the <form> there, and then closing two unopen <div>s. I would put the <form> two levels up, so that you can then close the divs without creating any problems.
Copy linkTweet thisAlerts:
@tgrk35authorNov 18.2005 — See, you're opening the <form> there, and then closing two unopen <div>s. I would put the <form> two levels up, so that you can then close the divs without creating any problems.[/QUOTE]

You've been very helpful, man. Thank you so much ?.
×

Success!

Help @tgrk35 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...