I'm not well-versed in PHP but managed to dynamically generated a page/list of items, and their descriptions, images.... including a checkbox before each items. That page - page 1 - is ok.
Viewing source shows that the Value of the checkboxes are generated correctly - which are the Item Ids - 1, 2, 3...Code:<form name="compareForm" method="post" action="page2.php"> <?php [loop] ..... <input type="checkbox" value="<?php print $id ?>" name="compare[]" /> <a href="javascript:document.compareForm.submit();">Compare</a> [end loop] ?> </form>
However, if I check some checkboxes and submit the form, the values don't seem to be passed to page 2, which has the following codes:
Things that I tried:Code:<?php $compare = $_POST["compare"]; foreach ($compare as $value) { print $value."<br />";} ?>
- Changed value="<?php print $id ?>" to hard-coded value="123": not work
- Use only one Submit button at the end of the form instead of the Submit links under each item: not work
Did I miss anything? or can we pass dynamically generated checkbox values?
Thanks for the inputs!



Reply With Quote


Bookmarks