I pull two IDs from a database via a query. One is the table's unique primary key (temp_id
), and one is not (auto_id
). The query gives me 1,477 records.
When I add these to an array like so, and then var_dump()
the array, I get the full 1,477:
<input type="checkbox" name="temp_id[]" value="<?=$auto_id?>">
However when I use this code, suddenly the array only contains 1,001:
<input type="checkbox" name="temp_id[<?=$temp_id?>]" value="<?=$auto_id?>">
Is there any inherent reason for this? As far as I can tell, because $temp_id
is unique, this should not cause any "clashes" in the data, or overwritten keys.
FORM CODE:
<?php
if (!isset($_GET['date']) || !filter_var($_GET['date'], FILTER_VALIDATE_INT)) {
header("Location: ./");
exit();
}
$date = $_GET['date'];
$upload_date = gmdate("Y-m-d H:i:s", $date);
require_once("db.php");
$automatch_query = mysql_query("SELECT temp_id, auto_id FROM advertisers INNER JOIN update_tempdata ON advertisers.advertiser_id = update_tempdata.auto_id WHERE auto_id > 0 AND upload_date = '$upload_date' ORDER BY advertiser_name");
?>
<form action="match-auto-script.php" method="post">
<?php
while ($automatch_data = mysql_fetch_assoc($automatch_query)) {
extract($automatch_data);
?>
<input class="toggleable" type="checkbox" name="temp_id[<?=$temp_id?>]" value="<?=$auto_id?>" checked>
<?php
}
?>
</form>
SCRIPT:
<pre><?php var_dump($_POST); ?></pre>