IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
1 Post

Pinned topic PHP won't display dynamic table/form when called by Jquery with $.post(...

‏2012-02-18T23:51:58Z |
Within my revise.php program I have the following code which, if you run the program as a stand alone will produce a table/form.

If I call this module, revise.php, from an .html module with: $.post("revise.php", {id: revId, revData: revFlg, dName: dispName}, showResultsFromServer, "json"); the table/form will not be produced. You get a blank screen.

What I'm trying to do is:

Stage 1. From looking at a table showing only the existing data contained in the selected (no blank fields) database record, if I decide to revise the data => Stage 2. call a 'file.php' to dynamically generate a Form in Table format containing all fields in the record so that I can revise/add data then Update the data in the database. Stage 3. => After that re-query the database and return that data to the original calling file.php which will display the JSON formatted data returned from that second query. The problem is Stage 2. will only display a blank page. It will not display the form. Firebug Response shows only the printf statements as code.

Any help in resolving this would be appreciated.

Thanks RP.

foreach($rowsRead[0] as $key => $value) 

"") $connectData[$key]=$value; 
}   printf(
"<div id="who
">");   printf(
"<fieldset class='rev1'>"); printf(
"<legend>Revising Record %s </legend>", $revId); printf(
"<form name='revContactForm' id='revContactForm' method='POST' action=''>\n"); printf(
"<table class='revForm' border='3' cellpadding='5'  bgcolor='#feede3' ><tr>\n");   printf(
"<td><input type='text' hidden='hidden' name='revFlg' id='revFlg' value='true'></input></td></tr>\n"); printf(
"<td><input type='text' hidden='hidden' name='revId' id='revId' value=%s></input></td></tr>\n",$revId);   foreach($rowsRead[0] as $key => $value) 

'Name_ID' | $key==

}; printf(
"<td><label for='%s'>%s</label></td>\n",strtolower($key), preg_replace(
" ",$key)); 

{ printf(
'<td><input type="text" name="%s" onfocus="showDisplayName();" id="%s" value="%s"></input></td></tr>\n', strtolower($key), strtolower($key), $value);   


if (contains($key, 
{ printf(
"<td><textarea name='%s' id='%s'  rows=5 cols=81> '%s' </textarea></td></tr>\n",strtolower($key), strtolower($key), $value); 

}; printf(
"<td><input type='text' name='%s' id='%s' value='%s'></input></td></tr>\n", strtolower($key), strtolower($key), $value); 
// for each    printf(
"<tr><td><input type='submit' class='hov'  name='submit' value='Save Contact Data'></input></td></tr>\n"); printf(
"</table></form></fieldset></div>\n");     printf(
"<div id="inputForm
// <!-- inputForm -->\n"); printf(
"<div id="controls
//printf("<button type='button' class='hov' name='connect' onclick=window.location.href='ContactFrontEnd.php'>Go Back</button>\n");             
//printf("<button type='button' class='hov'  name='savContact' value='Save Contact Data' onclick=saveContact()>Save Contact</button>\n"); 
//printf("<input type='submit' class='hov'  name='submit' id='submit' value='Save Contact Data'></input>\n");   printf(
"</div>\n"); printf(
"<div id="rbox
">\n</div>\n"); printf(
"<div id="rbox2