I have a dynamic drop down box which calls another PHP page. I've got it to work just how I want it.
Below is the part of the form:
<tr>
<td>
<p> Select a delivery date </p>
</td>
<td>
<select name='listdate' onchange='showDelivery(this.value)'>
<option value=''>select delivery type:</option>
<option value='forwardorder'>Forward Order</option>
<option value='byreturn'>By Return</option>
</select>
<div id='txtHint'>
<b>Change to drop down box to display delivery date</b>
</div>
</td>
</tr>
The Ajax
function showDelivery(str)
{
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getDelivery.php?q="+str,true);
xmlhttp.send();
}
The php script
$q=$_GET["q"];
// And create a cid object
require_once $CID_INCLUDE_PATH . "/cid.php";
$cid = new CHCID();
if ($q == 'forwardorder')
{
echo"<td><select 'name'='deliveryDate'/> ";
$listCapacityDates = $cid->ListCapacity();
foreach($listCapacityDates as $x) {
echo "<option value='".$x."'>".$x."</option> </select>";
}
}
if ($q == 'byreturn')
{
echo"<div id='div1'>Enter By Return Date<input type='text''name='deliveryDate' />
</div>";
}
I know the problem, because the results from the Ajax drop downs are shown through the PHP pages when the form submits none of those values are submitted. But I'm not sure how I can even submit them? Any ideas?