Hi
I am writing an aplication to select a predefined time interval (usually one month)
So i have tree texfields:
one to select the start time,
one to store the selected start time and
other to compare and retrieve from an oracle db the finish time if any.
I have a jacvascript function using xml to write the selected value on the fly using onChange
How can i assign the selected value from xml to php i try the following code:
<XML ID="xmlPeople">
<PERSON>
<FULLNAME></FULLNAME>
<?php $periodo = ?><PERIODO>Período</PERIODO>
</PERSON>
</XML>
All the code:
<?php
session_start();
$dataini=$POST['SELECAO'];
$datafim=$POST['DATA_ENCERRAMENTO'];
?>
<html>
<body>
<?php
$db_conn = ocilogon("xx", "xx", "xx");
$cmdstr = "select * from table";
$parsed = ociparse($db_conn, $cmdstr);
ociexecute($parsed);
$nrows = ocifetchstatement($parsed, $results);
?>
<SCRIPT LANGUAGE="JAVASCRIPT">
function update_fullname(){
xmlPeople.documentElement.childNodes.item(0).text
= document.forms[0].PERIODO.value;
}
</SCRIPT>
<table width="100%" border="0" bgcolor="FFFFFF" style="border: 2px solid orange" cellpadding="4" cellspacing="0">
<tr>
<td bgcolor="FFFFFF">
<SPAN DATASRC="#xmlPeople" DATAFLD="FULLNAME"></SPAN>
<XML ID="xmlPeople">
<PERSON>
<FULLNAME></FULLNAME>
<?php $periodo = ?><PERIODO>Período</PERIODO>
</PERSON>
</XML>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<table cellpadding="4" cellspacing="0" border="0" DATASRC=#xmlPeople>
<tr>
<td>Selecionar período</td>
<td>Período selecionado</td>
<td>Data de encerramento</td>
</tr>
<tr>
<td>
<select name="SELECAO" onChange="update_fullname();" ID="PERIODO" DATAFLD="FULLNAME">
<option value="Selecione" selected>Selecione
<?php
for ($i = 0; $i < $nrows; $i++ ) {
echo "<option value=\"".$results["PERIODO"][$i]."\">" .$results["PERIODO"][$i] ."";
}
?>
</select>
</td>
<td><input type="text" name="PERIODO1" value="<?php $dataini ?>"></td>
<td><input type="text" name="DATA_ENCERRAMENTO" value="<?php $datafim ?>">
</td>
</tr>
<tr>
<td colspan="3" align="right">
<input type=image name=submit' src='../../img/bt_confirmar.gif' border=0 alt='Clique aqui confirmar o período' align='absbottom'>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
Best regards