Not everyone is aware of this fact, so I thought I'd share it. You can have a single form, with multiple submit buttons, and then determine which button was clicked as to what action to take. Take the following code:
If your user clicks on the "edit" button, then $_POST["edit"] will be available, and the same if they click on the "delete" button. You can test for these buttons within your PHP code, and then perform the related actions:
PHP:
-
if(isset($_POST["edit"]) &&
trim($_POST["edit"])!==
'') {
-
//they clicked edit
-
//perform INSERT SQL Query
-
} elseif(isset($_POST["delete"]) &&
trim($_POST["delete"])!==
'') {
-
//they clicked delete
-
//perform DELETE SQL Query
-
} else {
-
//nothing has been clicked
-
//load initial form
-
}
November 16th, 2005
I decided to reformat my local webserver the other day. This server generally runs all my code on it before its published onto the web. I was using Fedora Core 4 Test 3, but decided to lose some stuff I've installed on there, and put a full release of FC4 on.
I settled on the following LAMP options:
I decided that I'd stick Oracle XE on as well, and have a play with that. Surely if MySQL is that simple to install then Oracle can't be that much harder! Or so I thought...
Read the full article (671 words & 1 image)
Continue Reading November 15th, 2005