zw1971
09-20-2003, 05:42 PM
I have a list box to be defined by php like this:
<?php
do {
?>
<option value="<?php echo $row_document_type['dt_id']?>"<?php if (!(strcmp($row_document_type['dt_id'], $row_document_type['dt_description']))) {echo "SELECTED";}?> ><?php echo $row_document_type['dt_description']; ?></option>
<?php
$dt_id=$row_document_type['dt_id'];
mysql_select_db($database_localhost, $localhost);
$query_document_index_definitions = "SELECT * FROM t_documentindexdefinition WHERE dt_id = $dt_id ORDER BY did_id ASC";
$document_index_definitions = mysql_query($query_document_index_definitions, $localhost) or die(mysql_error());
$row_document_index_definitions = mysql_fetch_assoc($document_index_definitions);
$totalRows_document_index_definitions = mysql_num_rows($document_index_definitions);
$dt_id=$row_document_type['dt_id'];
echo "<script language='javascript'>";
echo "var document_index_definition$dt_id=new Array(";
do{
echo "'";
echo $row_document_index_definitions['did_description'];
echo "'";
echo ",";
}while ($row_document_index_definitions=mysql_fetch_assoc($document_index_definitions));
echo "'foo')";
echo "</script>";
?>
<?php
} while ($row_document_type = mysql_fetch_assoc($document_type));
And I have dynamica html to show up a table based on the listbox selection like this:
<script language="JavaScript">
function display_index(obj)
{
var document_index=eval('document_index_definition'+obj)
//delete all rows
if ( tblDocumentIndexType.rows.length > 1 )
{
rowCnt = tblDocumentIndexType.rows.length ;
for ( rowPos = 1 ; rowPos < rowCnt ; rowPos++ )
{
tblDocumentIndexType.deleteRow( 1 ) ;
}
}
for(i=0;i<(document_index.length-1);i++)
{
var newRow=tblDocumentIndexType.insertRow();
var newCell=newRow.insertCell();
newCell.insertAdjacentHTML("AfterBegin", "<tr><td><font face=\"Times New Roman, Times, serif\" size=\"2\"><strong> " + document_index[i] + "<\/strong><\/font></td>");
newCell.insertAdjacentHTML("AfterBegin", "<td><input name=\"+did[i]+\" type=\"text\" size=\"15\"></td></tr>");
}
var newRow=tblDocumentIndexType.insertRow();
var newCell=newRow.insertCell();
newCell.insertAdjacentHTML("AfterBegin", "<tr><td></td><td> <input type=\"Submit\" name=\"Submit\" value=\"Submit\"></td></tr>");
}
</script>
question is after I click the "submit' button, how can I read the input boxes in the dynamic html in PHP.
Hope I explained my question clearly. Thanks for your help
<?php
do {
?>
<option value="<?php echo $row_document_type['dt_id']?>"<?php if (!(strcmp($row_document_type['dt_id'], $row_document_type['dt_description']))) {echo "SELECTED";}?> ><?php echo $row_document_type['dt_description']; ?></option>
<?php
$dt_id=$row_document_type['dt_id'];
mysql_select_db($database_localhost, $localhost);
$query_document_index_definitions = "SELECT * FROM t_documentindexdefinition WHERE dt_id = $dt_id ORDER BY did_id ASC";
$document_index_definitions = mysql_query($query_document_index_definitions, $localhost) or die(mysql_error());
$row_document_index_definitions = mysql_fetch_assoc($document_index_definitions);
$totalRows_document_index_definitions = mysql_num_rows($document_index_definitions);
$dt_id=$row_document_type['dt_id'];
echo "<script language='javascript'>";
echo "var document_index_definition$dt_id=new Array(";
do{
echo "'";
echo $row_document_index_definitions['did_description'];
echo "'";
echo ",";
}while ($row_document_index_definitions=mysql_fetch_assoc($document_index_definitions));
echo "'foo')";
echo "</script>";
?>
<?php
} while ($row_document_type = mysql_fetch_assoc($document_type));
And I have dynamica html to show up a table based on the listbox selection like this:
<script language="JavaScript">
function display_index(obj)
{
var document_index=eval('document_index_definition'+obj)
//delete all rows
if ( tblDocumentIndexType.rows.length > 1 )
{
rowCnt = tblDocumentIndexType.rows.length ;
for ( rowPos = 1 ; rowPos < rowCnt ; rowPos++ )
{
tblDocumentIndexType.deleteRow( 1 ) ;
}
}
for(i=0;i<(document_index.length-1);i++)
{
var newRow=tblDocumentIndexType.insertRow();
var newCell=newRow.insertCell();
newCell.insertAdjacentHTML("AfterBegin", "<tr><td><font face=\"Times New Roman, Times, serif\" size=\"2\"><strong> " + document_index[i] + "<\/strong><\/font></td>");
newCell.insertAdjacentHTML("AfterBegin", "<td><input name=\"+did[i]+\" type=\"text\" size=\"15\"></td></tr>");
}
var newRow=tblDocumentIndexType.insertRow();
var newCell=newRow.insertCell();
newCell.insertAdjacentHTML("AfterBegin", "<tr><td></td><td> <input type=\"Submit\" name=\"Submit\" value=\"Submit\"></td></tr>");
}
</script>
question is after I click the "submit' button, how can I read the input boxes in the dynamic html in PHP.
Hope I explained my question clearly. Thanks for your help