Alright, having some issues :(.
Here's what I have so far. Here's the form:
[html]
Date
Category
No Category Selected
<?php
$i=0;
while ($i<$num) {
$row = mysql_fetch_assoc($result);
echo "".$row['category']."";
$i++;
}
?>
OR
(Add a new category)
Content
[/html]
First off, don't worry about the PHP. This all works. Also, the onchange="changeNewCat()" works great too.
Let me give you javascript before I go further into this:
// Trying to code up a duplicate stopper!!
var dropdowns = document.getElementsByName("category");
var newCatDrop = document.forms[0].newcat.value;
for(var i = 0; i < dropdowns.value; i++) {
if (i == newCatDrop) {
alert("Sorry, no duplicates allowed.");
return false;
}
else {
// For debugging purposes, will remove later.
alert("No Match");
return false;
}
}
The javascript just doesn't work. Theres is more to this. Also, don't worry about the part that says onclick="return checkForm(this.form)" . The above javascript is a snippet, as this all works, except for the javascript stated above.
Am I not iterating properly. If someone could guide me or show me a little better way of getting this done, please do show.
I believe this is the last part of the validation of this form and it will be complete.
Any thoughts?