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.
[01:59 am]
RIVE -- Lots of fun little nods to different works of others in the cheats too.
[05:17 pm]
Oh_Man -- so i was today years old wen i learned rebel yell starcraft mission is named after a billy idol song. makes me wonder wat other missions are named after songs
[2026-6-04. : 3:42 am]
RIVE -- Hellooooo, Nurse
[2026-6-03. : 4:19 pm]
NudeRaider -- Hello World!
[2026-6-01. : 4:03 pm]
IskatuMesk -- no Hello World? No Hello . jpeg? Not even ddosing some government website? smh my head
[2026-5-31. : 10:02 pm]
Symmetry -- I was really just figuring out how to compile
[2026-5-31. : 10:02 pm]
Symmetry -- I didn't make it do anything
[2026-5-31. : 9:17 pm]
Ultraviolet -- hell yeah. did you have trouble making the button functional, or just haven't gotten there yet?
[2026-5-31. : 8:29 pm]
Symmetry -- I made the marine shoot lasers and gave the medic a nonfunctional button
[2026-5-31. : 8:07 pm]
Ultraviolet -- Symmetry
Symmetry shouted: I did my first EUD thing today. Feels like me finding arsenal at age 8 again
haha for sure. in some ways it's even more exciting because you can play EUD maps on regular battle.net, don't need to convince someone to download your mod to play with you. what did you do?
Please log in to shout.


Members Online: Ultraviolet