I have a PHP report that shows all comments within an oracle database for a specified date
what i want to do is hide records that have offensive material in them by giving the user the ability to tick a checkbox next to the record and click a button that will then update a field in the database called $visible to a 1 thus hiding it when the report is next generated.
How would i go about linking the button to the code?
That generally requires a FORM to be submitted (especialy for reliability -- in case JavaScript is disabled), however (speculating), a little JavaScript can do the trick with just an image (no checkbox required).
The PHP page shown could also serve up a change in the image to indicate success.
A little more JavaScrpit code could also immediately hide the current table row.
sorry if i sound a bit daft but in the onclick part do i reference the section of code that I would like to run in the $id section?
Also am trying to figure out how to get php to do the following:
$ticked_string = "";
$unticked_string = "";
rowcount = count of rows
for x = 1 to rowcount
if row(x).checkbox is ticked then
$ticked_sting = $ticked_string & row(x).contact_id & ","
else
$unticked_sting = $unticked_string & row(x).contact_id & ","
end if
Loop
$update1_string "update sms_out_audit set visible = 0 where contact_id in (" & $unticked_string & ");"
$update2_string "update sms_out_audit set visible = 1 where contact_id in (" & $ticked_string & ");"
The piece of code you wish to run would be in a document called "hideid.php" -- and, obviously, you can use any document name here you wish. The $id part would be an identifier which tells you which section of the report needs to be omitted next time.
it doesn't need to be a button or a post, on each row create a link <a href="hideid.php?id=<?=$id?>">Hide</a> then in hideid.php update the row with the given id and redirect back to the report page
not sure if i have explained myself properly as am still confused
I have a report that outputs comments from an oracle database into a PHP page.
What I want to do is put checkboxes/radio buttons beside each record that it outputs so if an abusive comment comes in I can click the checkbox/radio button next to it, click update and it will hide the record.
To hide it all i need to do is be able to send the value 1 from my result set to a column called $visible in my database and for it then to post back to the same page.
Is it possible?? Am going crazy trying to figure it out
Ok I have managed to get the code to work but in my hideid.php i cant see how to pull in the contactid? It has it in the address bar but how to i get my code to run so that it just updates the record specified?
Bookmarks