tjg73 Posted December 17, 2007 Share Posted December 17, 2007 Here is my problem. Basically the process is this: When a user clicks on a checkbox on page 1 that holds the array of id numbers, a separate browser window opens up (page 2)prompting them to click a button. When that button is clicked I want to update mySQL table based on the id number that was checked from that checkbox on page one. Did that make sense? So really I am not sure how to get that id checkbox value and put it into a variable so I can use it on page 2. Can anyone please help!!!! Thanks tjg Quote Link to comment Share on other sites More sharing options...
koen Posted December 17, 2007 Share Posted December 17, 2007 So you have a couple of checkboxes on the first page that each hold an array,eg array(2, 5, 7) for checkbox 2. Then on the second page, after a user has chosen checkbox 2, you want a button for each of these values in the array. Is that what you want? Quote Link to comment Share on other sites More sharing options...
tjg73 Posted December 17, 2007 Author Share Posted December 17, 2007 There are a few checkboxes on page 1. It is one array of records out of the db. The checkbox's value is the id field of the db. That value when the checkbox is clicked has to go across to page 2 where there is a button that when clicked changes a column in the table simply from a "No" to a "Yes" based on that id value. Was that a little more clear? Quote Link to comment Share on other sites More sharing options...
stuffradio Posted December 17, 2007 Share Posted December 17, 2007 Here is a quick and dirty one: checkboxes: <?php // I assume you are echoing them with a while statement, you should have initiated a form as well posting the values on to another page while (// your expression) { echo "<input type='checkbox' name='yourname[]' value='$array[checked]'>"; } ?> process the values <?php $yourname = $_POST['yourname']; foreach ($yourname as $key => $value) { mysql_query("UPDATE `table` SET `field`='yes' WHERE `id`='$value'"); } ?> Edit that, make it more secure, etc. 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.