Switch Statements and Form Variables
Posted: Sun Jun 29, 2003 4:28 pm
Ok, so I have a few switch statements set up to do various things. These things include updating the DB, deleting something from the DB, and viewing a list of items in the DB.
Now, I can get it from the list to the screen to update beacuse that is done via a link, but on the update screen there are 2 form buttons.
The beginning of the form looks like:
The problem that I run into is that I cannot pass the var from the buttons to the address bar to trigger my switch statements. Any idea on how to do this?
Code: Select all
<?php
if($a){
switch($a){
case "update":
//some code
break;
case "delete":
//some code
break;
// etc
}
}
?>Code: Select all
<input name="update" type="submit" value="Update">
<input name="delete" type="submit" value="Delete from DB">Code: Select all
<form name="addrecord" method="post" action="<?php echo"$PHP_SELF?a=$name"; ?>">