Forum Moderators: coopster

Message Too Old, No Replies

Is it possible to execute a MSSQL query by pressing a 'Submit' button?

         

BadGoat

6:27 pm on Dec 29, 2005 (gmt 0)

10+ Year Member



Hiya!

Currently I have a page which allows me to add users to an event. I have a drop down menu with the users, and my goal is to be able to add users to a table, so when I want to display the event, I can also see the users who are to attend. As it stands now, I have it coded, albeit incorrectly. I can submit users, I can display them with the event correctly, but I am having a couple issues.

1) Anytime I hit F5, a blank record is added to the table.
2) I cannot for the life of me figure out how to delete a user from the list! I understand it in theory, bgut I cannot figure out how to tie a sqlquery DELETE to an HTML link which when pressed will execute the query.

So, is it possible to tie a sql INSERT query into an HTML 'Submit' button? Is it possible to tie a sql DELETE query to an HTML link?

Any help is appreciated. I can post code, once I sanitize it of the garbage html tags which clutter up my already-confusing php ;)

coopster

9:38 pm on Jan 5, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



To stop from adding blank rows you simply need to edit the data first and make certain there are no blanks where there should be values. While you are at it, make sure the values contain the proper format of information you are expecting and not something malicious from the user ;-) Always good to be as security-conscious as possible!

To tie your query to your buttons/links you need to attach the PRIMARY KEY values to those associated <input> elements so that you can use those values in your query.