Originally posted by AdminsDeath
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
document.write(slash(<?php echo"<form><input type=text></form>"; ?>)+'<BR>');
// End -->
</script>
I don't get that section. There's no point having the php echo there, nor the javascript document.write, because they would output the same thing every time. And isn't the slash() function supposed to take a date string as its input? The way you have it now will just cause an error.
Here's my idea:
<script>
(your slash function here) {
.
.
.
}
function addslashes(theinput) {
theinput.value = slash(theinput.value);
}
</script>
.
.
.
<form>
<input type=text name="date_input">
<input type=submit onClick="addslashes(date_input)">
</form>
That way it will add the slashes when you submit the form, asuming your slash function works as expected (i didn't really look at it).
Of course, the most robust and cross-platform compatible way to do all error checking is on the server with PHP, so you don't have to rely on different browsers' weird versions of javascript.
Another approach would be to make 3 different select boxes, one for day, one for month, one for year. That would be my first choice.