jeff5656 Posted January 26, 2009 Share Posted January 26, 2009 I have a variable called completed with enum of either 'y' or 'n'. When a user clicks this link <a href="updatebill.php?action=edit&id=<?php echo $row2['dos_id']; ?>"> <?php echo $row2['completed'];?></a> I want to change the value to n if it is set as y, and y if it is set as n. Here is the action php file that the link goes to: switch ($_GET['action']) { case "edit": $sql = "UPDATE dos SET completed = 'n'"; if (isset($sql) && !empty($sql)) { echo "<!--" . $sql . "-->"; $result = mysql_query($sql) or die ("Invalid query: " . mysql_error()); } So everytime they click it, the value changes from it's current value (either y or n) to the Other value. Thanks! Link to comment https://forums.phpfreaks.com/topic/142500-solved-how-do-i-change-the-enum-value-based-on-user-clicking/ Share on other sites More sharing options...
gevans Posted January 26, 2009 Share Posted January 26, 2009 If you pass the character in the url; <a href="updatebill.php?action=edit&id=<?php echo $row2['dos_id'].'&completed='.$row2['completed']; ?>"> <?php echo $row2['completed'];?></a> Then on the next page set the variable to use in the sql query; $completed = ($_GET['completed'] == 'y')? 'n' : 'y'; Link to comment https://forums.phpfreaks.com/topic/142500-solved-how-do-i-change-the-enum-value-based-on-user-clicking/#findComment-746714 Share on other sites More sharing options...
jeff5656 Posted January 26, 2009 Author Share Posted January 26, 2009 Thanks! Link to comment https://forums.phpfreaks.com/topic/142500-solved-how-do-i-change-the-enum-value-based-on-user-clicking/#findComment-746718 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.