Jump to content

Recommended Posts

haii...i new in js. i want ask why my coding not run. i use php and javascript. this is my sample coding

 

Briefly description: start_date and closing_date retrieve from database and date_me will key in by user

example  start_date=2008-10-02  closing_date=2008-10-11

<script type="text/javascript">
function validDate(me)
{
var prob=false;

if(me.date_me.value=="")
{
	alert("Please enter date");
	prob=true;
}

if(me.date_me.value>me.closing_date.value)
{
	alert("Please enter valid date");
	prob=true;
}

if(me.date_me.value<me.start_date.value)
{
	alert("Please enter valid date. The date are entered already close");

}

if(prob)
{			
	return false;
}

else
{
	return true;
}
}
</script>

 

When user key in date_me>closing_date(2008-10-11)the program is success. then only 2008-10-11 and 2008-10-10 can add by user in database. why below then 2008-10-10(2008-10-9, 2008-10-8 and so on) user still cannot add (error massege appear "Please enter valid date").i thought if date_me>closing_date(2008-10-11), all date below than 2008-10-11 which are 10,9,8,7,6,5 oct 2008 still can add. by why only 10 and 11 october.

 

then for date_me<start_date(2008-10-02) why when i put 2008-09-01 it still can add. suppose error mesage will appear "Please enter valid date".

 

i dont know if i forgot something.can you help me. plzzzzzzzz  ??? ??? ???

Link to comment
https://forums.phpfreaks.com/topic/129506-why-this-coding-not-run/
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.