Staredit Network > Forums > Technology & Computers > Topic: "Delete Shouts"
"Delete Shouts"
Jul 16 2009, 9:08 pm
By: Devourer  

Jul 16 2009, 9:08 pm Devourer Post #1

Hello

Hey everyone,
I've coded a shoutbox with features like colors and stuff. What I want to do is that a "X" (picture) will appear in front / behind each shout that will "onclick" (there is an onclick function for pictures) delete that shout.
The problem is I don't know how to directly make it, best way I do not get linked to another page. The shoutbox is inside of a frame, and inside of the frame there is an iframe for the shouts (listed).
I know the "delete" code for the mysql tables, but I don't get how to use it for a listed table. The table "shouts "got the columns ID, user, color, shout.


Can someone help me out?



Please report errors in the Staredit.Network forum.

Jul 16 2009, 10:10 pm DT_Battlekruser Post #2



The onclick field is a JavaScript action, and therefore not capable of accessing PHP through the standard CGI interface. What you need if you want to not reload the page with a form submit button is AJAX. Essentially what this does is sends an XHTTP request behind the scenes and PHP can return something to this request using echo.

As far as deleting from a table, each should should have an ID number that is an entry in the table. Then you do DELETE FROM ... WHERE shout_id = id

You need a separate .php file for the ajax request, so the AJAX request in the JavaScript looks something like

Code
var addr = "ajax/delete_shout.php?id=" + id;
xmlhttp.open("GET", addr, true);


I know this is a little spotty in terms of help, but the AJAX tutorial is pretty good.




None.

Jul 17 2009, 3:17 am Corbo Post #3

ALL PRAISE YOUR SUPREME LORD CORBO

What I do is make it a form and assign that form the desired action, you know.
<form action='blah.php'></form>

You could either make the "X" a submit type button or you could make the "X" a link (like I assume you have it as right now) and do onClick="javascript:document.form.submit();"

I do form cause I also send in other hidden data for later permissions check and verification, you could easily just directly link to the action.

If you have the shouts in an iframe, only the frame will reload.



fuck you all

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:13 pm]
Oh_Man -- No APM in chess. Computer just outthinks the human by seeing more moves ahead and more permutations
[10:12 pm]
Oh_Man -- U reckon? Kasparov waa defeated by computer decades ago
[05:47 pm]
NimoStar -- If its any consolation, the human brain would still mop the floor with this bot if it wasn't limited by the mechanical interface
[05:34 pm]
NimoStar -- Well. The bot didn't come up with any new strategy. It just has superhuman micro. Hard to beat that. I reckon even the simplest dedicated chess engines are unbeatable for humans now.
[02:13 pm]
Oh_Man -- all g
[10:54 am]
NudeRaider -- Oh_Man
Oh_Man shouted: NudeRaider did u watch the entire video? it's not one game. it's currently dominating the ladder at number 1 position. do ur research first!
Oops, caught me there, no I haven't. :( I was imagining how the game went. Sorry for that. Watching it now. brb
[10:52 am]
NudeRaider -- NimoStar
NimoStar shouted: They were not "Unprepared" that was their fifth loss in a row against the bot. The other replays are also available
that doesn't mean he was prepared. When humans come around with new strategies it often takes weeks until the pros figure out how to shut it down. Oh_Man that's certainly a way more convincing argument for micro being "too good to beat".
[09:43 am]
DiearAnother -- wirefram
[08:35 am]
NimoStar -- Well, pros showed that long ago... half of zerg pros just ling muta rush
[08:35 am]
NimoStar -- " its shown is that you can trade 1000's of apm to make up for lack of strategy"
Please log in to shout.


Members Online: Zoan, RIVE