I’m writing a site with shop and chat.
I’m trying to admin users messages in a page.
In the header’s the submit function:
function ins_dom(){
global $wpdb;
$risp = $_POST['risp'];
$i = $_POST['ins_dom'];
$id = $id[$i];
//must have comment
if(!$risp){
exit;
}
// query
$wpdb->insert(
'm_comm',
array(
'comm_usr_id' => 1,
'comm_utente' => $id,
'testo' => $risp,
'risp'=>1
),
array(
'%d' ,
'%d' ,
'%s',
'%s'
)
);
return true;
};
And here’s the body:
<form Name ="ins_dom" Method ="POST" ACTION = "">
<table><tr><td>
id</td><td>
question</td><td>
answer</td><td>
submit</td></tr>
<?
$dom=chiedi_2();
if(count($dom)>0) {
for ($i = 0; $i < count($dom); $i++) {
$id[$i]= $dom[$i]->comm_usr_id;
$testo[$i]= $dom[$i]->testo;
echo "<tr id=$i><td>".$id[$i]."</td>.
"<td>".$testo[$i]."</td><td>".
"<textarea value='risp' name='risp' maxlength='200' cols='30' rows='4'></textarea></td><td>".
"<INPUT TYPE = 'Submit' Name = 'invia' VALUE = '$i'></td></button></td></tr>";
}
};
echo "</form></table>";
?>
Browser doesn’t notice errors I’m blocked here.
All I would like to do is to insert the query.
The form works pretty good and when I click the botton page refreshes but nothing appens