can any one help me with this code, I am using this code for display No.of days in given date date format is 25/04/2011

function month()
    {
	var date = document.getElementById('datetxt').value;
	var curr_month = parseFloat(date.substring(3,5));
	var curr_year = parseFloat(date.substring(6,10));
        
        var day =  cal_days_in_month(CAL_GREGORIAN, Number(curr_month),Number(curr_year));
	document.getElementById('nodaytxt').value= day ;
    }

Its not working on onchange in my PHP

input type="text" class="contact_input" id="loptxt" name="loptxt" value="" onchange="monthday()" />

Try this code..

<?php
 function MonthDays($someMonth, $someYear)

      {

      return date("t", strtotime($someYear . "-" . $someMonth . "-01"));

      }
//for example	  
$someMonth=4;	  
$someYear=2011;
$d=MonthDays($someMonth, $someYear);	
echo $d;  

use 'explode' function to grab month and year from the date!!	  
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.