3raser Posted January 15, 2011 Share Posted January 15, 2011 Whenever people are going to update something, they have a list of things to update. Whenever they choose the file they wish to edit/re-upload, they click the [EDIT] link beside it. This takes them to the update page, of course on the same file. They still have edit.php?id=3 in the URL, for example. But whenever they click Submit, how am I suppose to get the ID again? Is there a less junky way to do it then this: if(!$_GET['id'] && $_POST['id']) { $id = $_POST['id']; } elseif($_GET['id'] && !$_POST['id']) { $id = $_GET['id']; } else { } Link to comment https://forums.phpfreaks.com/topic/224546-is-there-an-easier-way-to-do-this/ Share on other sites More sharing options...
phpfreak Posted January 15, 2011 Share Posted January 15, 2011 You could look into using $_REQUEST and even try to use a switch() in php. Link to comment https://forums.phpfreaks.com/topic/224546-is-there-an-easier-way-to-do-this/#findComment-1159892 Share on other sites More sharing options...
punk_runner Posted January 15, 2011 Share Posted January 15, 2011 Assuming the form they edited has method="post" set, it will be back in the $_POST array, so if they edited their last name, it would be in $_POST['lastname']; Link to comment https://forums.phpfreaks.com/topic/224546-is-there-an-easier-way-to-do-this/#findComment-1159894 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.