Thank you, that is a mistake on my part. But even after changing the error and after modifying the message instruction on php echo the old message still appears. Another thing, I use smarty. But I have a new problem is to select my data from the database from a test.
HTML Code:
{literal}
<script language='javascript'>
function add_tache(){
var value = this.ordi_enr.lst_tache.options[this.ordi_enr.lst_tache.selectedIndex].value;
var text = this.ordi_enr.lst_tache.options[this.ordi_enr.lst_tache.selectedIndex].text;
document.forms.ordi_enr.tache_eff.options[document.forms.ordi_enr.tache_eff.options.length] = new Option(text,value);
this.ordi_enr.lst_tache.options[this.ordi_enr.lst_tache.selectedIndex] = null;
}
function drop_tache(){
var value = this.ordi_enr.tache_eff.options[this.ordi_enr.tache_eff.selectedIndex].value;
var text = this.ordi_enr.tache_eff.options[this.ordi_enr.tache_eff.selectedIndex].text;
document.forms.ordi_enr.lst_tache.options[document.forms.ordi_enr.lst_tache.options.length] = new Option(text,value);
this.ordi_enr.tache_eff.options[this.ordi_enr.tache_eff.selectedIndex] = null;
}
function getXhr(){
var xhr = null;
if(window.XMLHttpRequest)
xhr = new XMLHttpRequest();
else if(window.ActiveXObject){
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
}
else {
alert("Your browser does not support XMLHTTPRequest objects...");
xhr = false;
}
return xhr
}
function go(ip){
if(ip != ""){
var val_ip = document.getElementById('ip_ordi').value;
var xhr = getXhr()
xhr.onreadystatechange = function(){
if(xhr.readyState == 4 && xhr.status == 200){
document.ordi_enr.dysfon.value = xhr.responseText;
}
}
xhr.open("POST","load_dysfon.php",true);
var data = escape(document.getElementById('ip_ordi').value);
xhr.send(data);
}else { document.ordi_enr.dysfon.value = "";}
}
</script>
{/literal}
<form name="ordi_enr" action="inter_add.php" method="post" onsubmit="return verif_form();">
<fieldset><legend><h4><span class="style1"><em>Intervention</em></span></h4></legend>
<p align="center"><label for="ip_ordi">IP : </label>
<select name="ip_ordi" onchange="go(this.value)">
<option value=""></option>
{section name=idx loop=$list_ip}
<option value="{$list_ip[idx].ip_ordin}">{$list_ip[idx].ip_ordin}</option>
{/section}
</select>
<label for="dysfon">Dysfonctionnement:</label>
<textarea name="dysfon" cols="60" readonly="true"></textarea></p>
<p align="center"><label for="lst_tache">List of tasks(s):</label>
<select name="lst_tache" size="5" style="width:255px" onchange="add_tache();">
{section name=idx loop=$lst_tache}
<option value="{$lst_tache[idx].num_tach}">{$lst_tache[idx].lb_tache}</option>
{/section}
</select>
<label for="tache_eff">Task(s) effect(s):</label>
<select name="tache_eff" size="5" style="width:255px" onchange="drop_tache();">
</select></p>
</fieldset>
<p align="center">
<input name="submit" type="submit" value="Save info." />
</p>
</form>
The content of load_dysfon.php
PHP Code:
<?php
header("Cache-Control: no-cache, must-revalidate");
header('Content-type: text/html; charset=iso-8859-1');
require_once('config.inc.php');
$select_dysf = mysql_query("SELECT num_dysf,ip_ordin,dte_day,dysfo_or FROM tb_dysfon WHERE ip_ordin'".$_POST['data']."'");
while ($row = mysql_fetch_row($select_dysf))
{
echo $row[3];
}
?>
By checking the value of $ _POST [ 'data'], it is empty.
Bookmarks