<html>
<link rel="stylesheet" media="screen" href="DynCalendar/dynCalendar.css" />
<script language="javascript" type="text/javascript" src="DynCalendar/browserSniffer.js"></script>
<script language="javascript" type="text/javascript" src="DynCalendar/dynCalendar.js"></script>

<body>

<table width="703" height="210" border="1" cellpadding="5" cellspacing="0">
  <tr>
    <td width="535"><form name="Add_Record"><form action="insert.php" method="POST">
      <p class="Headings"><strong>Add a Record</strong>      </p>
    <p>First Name:
        <input type="text" size="20" maxlength="20"name="firstname" />
        Last Name:
        <input type="text" size="20" maxlength="20" name="lastname" />
  </p>
      <p>Days Used:
        <input type="int" size="3" maxlength="3"name="DaysUsed" /> 
        Hours Used:
        <input type="int" size="4" maxlength="4"name="HoursUsed" />
       Leave Type:
        <select name="type">
          <option value="0"> </option>
          <option value="Sick">Sick</option>
          <option value="Vacation">Vacation</option>
          <option value="Business">Business</option>
          <option value="Funeral">Funeral</option>
          <option value="Other">Other</option>
          <option value="Errand">Errand</option>
        </select>
      </p>
      Start Date:
      <input type="text" name="StartDate">
    <script language="JavaScript" type="text/javascript">
    <!--
    /**
    * Example callback function
    */
    function exampleCallback_ISO1(date, month, year)
    {
        if (String(month).length == 1) {
            month = '0' + month;
        }
    
        if (String(date).length == 1) {
            date = '0' + date;
        }    
        document.forms['Add_Record'].StartDate.value = month + '/' + date + '/' + year;
    }
    calendar1 = new dynCalendar('calendar1', 'exampleCallback_ISO1');
    calendar1.setMonthCombo(true);
    calendar1.setYearCombo(true);
    //-->
    </script>
     
        End Date:
       <input type="text" name="EndDate">
    <script language="JavaScript" type="text/javascript">
    <!--
    /**
    * Example callback function
    */
    function exampleCallback_ISO2(date, month, year)
    {
        if (String(month).length == 1) {
            month = '0' + month;
        }
    
        if (String(date).length == 1) {
            date = '0' + date;
        }    
        document.forms['Add_Record'].EndDate.value = month + '/' + date + '/' + year;
    }
    calendar2 = new dynCalendar('calendar2', 'exampleCallback_ISO2');
    calendar2.setMonthCombo(true);
    calendar2.setYearCombo(true);
    //-->
    </script>
    </script>
    
      <p><br>
        Details:
        <input type="text" size="20" maxlength="20"name="Details" />
        <input type="submit" name="Submit" value="Add Record" action="insert.php" /> 
      </p>
    </form></td>
  </tr>
</table>

I just added this javascript to my html form for the dropdown calendar function, now it will not post to the insert.php. Can someone tell me what I need to change to make the javascript post to the insert.php?

Thank you!

Currently you have TWO open <form> tags. Get rid of the first one and instead
put the <FORM> around the <table> and give your form an id="Add_Record" :

<html>
<head>
<!-- <link rel="stylesheet" media="screen" href="DynCalendar/dynCalendar.css" />
<script language="javascript" type="text/javascript" src="DynCalendar/browserSniffer.js"></script>
<script language="javascript" type="text/javascript" src="DynCalendar/dynCalendar.js"></script>
 -->
<link rel="stylesheet" media="screen" href="http://www.phpguru.org/css/dynCalendar.css" />
<script language="javascript" type="text/javascript" src="http://www.phpguru.org/javascript/sniffer.js"></script>
<script language="javascript" type="text/javascript" src="http://www.phpguru.org/javascript/dynCalendar.js"></script>
</head>
<body>

<form id="Add_Record" action="insert.php" method="POST">

<table width="703" height="210" border="1" cellpadding="5" cellspacing="0">
  <tr>
    <td width="535">
      <p class="Headings"><strong>Add a Record</strong>      </p>
    <p>First Name:
        <input type="text" size="20" maxlength="20"name="firstname" />
        Last Name:
        <input type="text" size="20" maxlength="20" name="lastname" />
  </p>
      <p>Days Used:
        <input type="int" size="3" maxlength="3"name="DaysUsed" /> 
        Hours Used:
        <input type="int" size="4" maxlength="4"name="HoursUsed" />
       Leave Type:
        <select name="type">
          <option value="0"> </option>
          <option value="Sick">Sick</option>
          <option value="Vacation">Vacation</option>
          <option value="Business">Business</option>
          <option value="Funeral">Funeral</option>
          <option value="Other">Other</option>
          <option value="Errand">Errand</option>
        </select>
      </p>
      Start Date:
      <input type="text" name="StartDate">
    <script language="JavaScript" type="text/javascript">
    <!--
    /**
    * Example callback function
    */
    function exampleCallback_ISO1(date, month, year)
    {
        if (String(month).length == 1) {
            month = '0' + month;
        }
    
        if (String(date).length == 1) {
            date = '0' + date;
        }    
        document.forms['Add_Record'].StartDate.value = month + '/' + date + '/' + year;
    }
    calendar1 = new dynCalendar('calendar1', 'exampleCallback_ISO1');
    calendar1.setMonthCombo(true);
    calendar1.setYearCombo(true);
    //-->
    </script>
     
        End Date:
       <input type="text" name="EndDate">
    <script language="JavaScript" type="text/javascript">
    <!--
    /**
    * Example callback function
    */
    function exampleCallback_ISO2(date, month, year)
    {
        if (String(month).length == 1) {
            month = '0' + month;
        }
    
        if (String(date).length == 1) {
            date = '0' + date;
        }    
        document.forms['Add_Record'].EndDate.value = month + '/' + date + '/' + year;
    }
    calendar2 = new dynCalendar('calendar2', 'exampleCallback_ISO2');
    calendar2.setMonthCombo(true);
    calendar2.setYearCombo(true);
    //-->
    </script>
    </script>
    
      <p><br>
        Details:
        <input type="text" size="20" maxlength="20"name="Details" />
        <input type="submit" name="Submit" value="Add Record" action="insert.php" /> 
      </p>
</td>
  </tr>
</table>
    </form>
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.