Hello calida82,
Do make sure that you look for errors in the console; I had to change
const to
var to make this work. Anyway, here is a quick response which does work but you will need to add a bit more to get what you want. I have used my orginal SQL statement and the most basic way of putting some text (from the SQL result) in the DIV. Note that you need to use
db_fetch_array as well.
JavaScript for the form
Code: Select all
var intestazione = document.createElement("div");
intestazione.setAttribute("id", "nuIntestazioneHolder");
intestazione.setAttribute("style", "width: 100%; height: 50px; background-color:green;");
var container = document.getElementById("nuActionHolder");
container.parentNode.insertBefore(intestazione, container);
nuRunPHPHidden('php_nominativo');
This creates the DIV and then calls the code that pulls data from the server to add the content.
PHP procedure : php_nominativo
Code: Select all
$sql = "SELECT * FROM `zzzzsys_form` WHERE `zzzzsys_form_id` LIKE 'nu%' LIMIT 1";
$result = nuRunQuery($sql);
if (db_num_rows($result) == 1) {
$r = db_fetch_array($result);
$js = "
var jData = '".addslashes(json_encode($r))."';
var rData = JSON.parse(jData);
var rInfo ='Three values from a record in the table zzzzsys_form .... sfo_type = ' + rData.sfo_type + ' : sfo_description = ' + rData.sfo_description + ' : sfo_primary_key = ' + rData.sfo_primary_key ;
$('#nuIntestazioneHolder').text(rInfo);
";
nuJavascriptCallback($js);
}
You can call nuRunPHPHidden('php_nominativo'); as often as required, perhaps after changing the value of #pk_cliente# and the code will replace the contents of the DIV.
As I said, this is very basic but it demonstrates the functionality. Try using the code fragments here, check that they work and then make the modifications to the SQL etc so that you get what you want.
Let me know how you get on.
Neil