NathanLedet Posted July 28, 2009 Share Posted July 28, 2009 So I have a form with a load of check boxes. User can select 1 or all of the check boxes, and then at the bottom of the form, there are two submit buttons. <input type="submit" name="remove" id="remove" value="Remove" /> <input type="submit" name="modify" id="modify" value="Modify" /> So, when I choose one of those submit buttons, my form action posts to something like "decision.php" My array of selections is then posted to that php file - and based on what was pushed (modify or delete), that array of data is then pushed on to a new file (modify.php or remove.php) that then processes it. Is this logic correct? or is there a simpler way? If this logic is correct, then I'm not sure how to again post my data on to modify or remove... Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 28, 2009 Share Posted July 28, 2009 you can't push it to a new page, both the modify/delete code has to be handled by the decision.php script. this is easy enough though...you can either put all the code in one file, or create a function for each and just call the appropriate function Quote Link to comment Share on other sites More sharing options...
NathanLedet Posted July 28, 2009 Author Share Posted July 28, 2009 I think the "deleting" portion can be handled quite easily by calling a delete function into "decision.php" However, "modify.php" contains forms and that sort of thing that would require a bit more. Would it be bad practice to set those checkbox values into an array in a session? and as soon as that's done - destroy the session? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 28, 2009 Share Posted July 28, 2009 um...it's not "bad"...just be careful to clear those out you can also pass the items to be modified in a GET variable when forwarding to modify.php: $keys = array(1,4,6,7,9); header('Location: modify.php?keys='.implode('|',$keys)); exit; the just explode the values on modify.php to know which ones you are modifying Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 28, 2009 Share Posted July 28, 2009 Personally, I would use similar logic to what you first described - execept that the initial processing page will first validate the submitted data. If validation fails I will redisplay the form with the values the user entered already populated/selected. If validation passes I will detemine the correct process to perform and include() the appropriate processing file. That way all of the GET/POST values are still available to the processing script. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.