bri0987 Posted October 17, 2007 Share Posted October 17, 2007 Here is what my form looks like: <form name="form1" method="post" action="testing.php"> <?php if (isset($_GET['Component_ID'])) { $Component_ID = (get_magic_quotes_gpc()) ? $_GET['Component_ID'] : addslashes($_GET['Component_ID']); } ?> <input type="hidden" name="Component_ID" value="<?php if (isset($Component_ID)) { echo $Component_ID; }?>" /> <p> <?php // 4. Use database retured data while ($row = mysql_fetch_array($db_result1)) { echo "<input type=\"checkbox\" name=\"Product_ID\" " . "value=\"" . $row["Product_ID"] . "\" />" . " " . $row["Product_Name"] . " <br />" ; } ?> </p> <p> <input type="submit" value="Submit" /> </p><?php if (isset($Component_ID)) { echo $Component_ID; }?> </form> When I check all of the boxes and I submit this form the data it returns on the testing page is: Component_ID=1&Product_ID=1&Product_ID=2&Product_ID=3&Product_ID=4 How do I take that post/get string. Turn it in an array or something and insert it into the database like this: Component_ID=1 > Product_ID=1 Component_ID=1 > Product_ID=2 Component_ID=1 > Product_ID=3 Component_ID=1 > Product_ID=4 I am trying to build a relational table between my products and the components... I just do not get how I can do this. Link to comment https://forums.phpfreaks.com/topic/73607-getting-the-post-data-from-a-form-in-many-rows/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.