primo_levi
nOObee
Joined: 14 May 2008
Posts: 1
3 Cash
|
 how to reload a page with data from a textbox of a form
Hi
i have a table1 with fields clientid, date and filename along with other fields.
i have to fill another table2 and i am using html form for that. in this form the user gets the client ids populated in a dropdown from the table1. the user selects a date which is taken in a text box using a simple javascript calendar. now the filename matching to the corresponding clientid and date has to be dynamically populated in a drop down.
i am able to populate the filename drop down corresponding to a client id. i am making a mysql query for that. and then make the page reload. But i am unable to get the list populated using the combination of both the fields(clientid and date)...how do i do it?
i think i am passing the value of the textbox in a wrong way. here is my code n relevant parts:
____________________________________________________________________
<script type="text/javascript">
function reload(form){
var val=form.clientid.options[form.clientid.options.selectedIndex].value;
var val1=form.receivedon.value;
//Thie line below doesnt work
//self.location='dbinven_entry.php?clientid=' + val '&receivedon=' + val1
self.location='dbinven_entry.php?clientid=' +val;
}
</script>
</head>
<body>
<?php
echo"<h1><center>Database Inventory</h1></center>";
$quer2=mysql_query("SELECT DISTINCT clientid FROM ClientInfo");
$clientid=$_GET['clientid'];
$receivedon=$_GET['receivedon'];
if(isset($clientid) and strlen($clientid) > 0){
$quer=mysql_query("SELECT DISTINCT filename FROM ddi where clientid='$clientid'");
}else{$quer=mysql_query("SELECT DISTINCT filename FROM ddi"); }
echo "<form action=inserttodbinven.php method=post name=dbinven >";
//Starting of clientID drop downlist autofed from ClientInfo //
echo "<table> <tbody>";
echo "<tr>";
echo "<td>";
echo "<label for ='clientid'>Client ID:</label></td>";
echo "<td><select name='clientid' onchange=\"reload(this.form)\"><option value=''>Select one</option>";
while($noticia2 = mysql_fetch_array($quer2)) {
if($noticia2['clientid']==@$clientid){echo "<option selected value='$noticia2[clientid]'>$noticia2[clientid]</option>"."<BR>";}
else{echo "<option value='$noticia2[clientid]'>$noticia2[clientid]</option>";}
}
echo "</select></td></tr>";
//end of the drop down list //
?>
<tr><td><label for="receivedon">Received on:</label></td>
<td><input type="text" name="receivedon" id="receivedon" value= "<?php $receivedon ?>" readonly onclick="fPopCalendar('receivedon')" /></td></tr>
<?php
echo "<tr><td><label for ='filename'>Parent File Name:</label></td>";
echo "<td><select name='filename'><option value=''>Select one</option>";
while($noticia = mysql_fetch_array($quer)) {
echo "<option value='$noticia[filename]'>$noticia[filename]</option>";
}
?>
______________________________________________________________________
thanks in advance for your help!
|