Hi!
can someone help me to figure out with this code?
<form method="POST" action="insert.php">
<input type="checkbox" name="id[]" value="32">Article #32<br>
<input type="checkbox" name="id[]" value="38">Article #38<br>
<input type="checkbox" name="id[]" value="45">Article #45<br>
<input type="checkbox" name="id[]" value="59">Article #59<br>
<input type="hidden" name="referer" value="123">
<!-- This is the ID of the "referring" article -->
<input type="Submit">
</form>
$ref = $_POST['referer'];
$query = 'INSERT INTO related_articles (id, referer) VALUES (' .
implode(", $ref), (", $_POST['id']) . ", $ref)";
$result = mysql_query($query)
or die('Could not execute INSERT query');
for an instance the user will checked articles #32 and #59
here's the query that is going to be executed:
INSERT INTO related_articles (id, referer)
VALUES (32, 123), (59, 123);
my question is how to configure this code:
$ref = $_POST['referer'];
$query = 'INSERT INTO related_articles (id, referer) VALUES (' .
implode(", $ref), (", $_POST['id']) . ", $ref)";
$result = mysql_query($query)
or die('Could not execute INSERT query');
to query like this one:
INSERT INTO detail (Quantity, Unit, Description)
VALUES (1, pcs, etc..), (4, pcs, etc...);
I really need your help with this guys because i'm stuck with this for an hour.
Thanks..