Hi Guys,
Here's the deal:
I have a page the lists "patterns". In this page is a link that opens up
a window that displays ALL the "threads" available in the database.
"Threads" need to be related to "patterns". What I mean by this is that
I need the ability to select (with a checkbox) the thread listing for
when I process the form, the patternID and the threadID are saved in a
table.
In addition to.. I need to be able to select ( from a checkbox) whether
or not this thread is available for direct ordering or not.
Here's some code:
(opener link):
<a href="JavaScript:windowOpener('openthreads.php?patternID=<?php echo
$id; ?>', 500, 370)">
(popup):
<?php
$threadQuery = db_query("SELECT * FROM kcs_threads");
for ($i=0;$threadResults = db_fetch($threadQuery);$i++)
{
$threadselectQuery = db_query("SELECT *
FROM kcs_patternthreads WHERE pattern_index='$patternID'");
while ($threadselectResult =
db_fetch($threadselectQuery)) {
?>
<input type="hidden" name="threadPattern_index[<?php
echo $i; ?>]" value="<?php echo $threadselectResult[id]; ?>">
<input type="hidden" name="thread_index" value="<?php echo
$threadResults[id]; ?>">
<input type="hidden" name="pattern_index" value="<?php
echo $patternID; ?>">
<tr valign="top">
<td class="adminthreadsDisplayText"
align="center"><input type="checkbox" name="select[<?php echo $i; ?>]"
value="1" <?php if ($threadselectResult[thread_index] ==
$threadResults[id]) echo "checked"; ?>></td>
<td class="adminThreadsDisplayText" align="left"><?php echo
trimString($threadResults[manufacturer],19); ?></td>
<td class="adminthreadsDisplayText" align="left"><?php
echo $threadResults["colourID"]; ?></td>
<td class="adminthreadsDisplayText" align="left"><?php
echo trimString($threadResults["colour"],19); ?></td>
<td class="adminthreadsDisplayText"
align="center"><input type="checkbox" name="avail[<?php echo $i; ?>]"
value="1" <?php if ($threadselectResult[thread_index] ==
$threadResults[id] && $threadselectResult[avail] == 1) echo "checked";
?></td>
</tr>
<tr>
<td><img src="../Graphics/spacer.gif" width="80"
height="1"></td>
<td><img src="../Graphics/spacer.gif" width="110"
height="1"></td>
<td><img src="../Graphics/spacer.gif" width="80"
height="1"></td>
<td><img src="../Graphics/spacer.gif" width="110"
height="1"></td>
<td><img src="../Graphics/spacer.gif" width="80"
height="1"></td>
</tr>
<?php
}
}
?>
If this were split into an "add" and an "edit" page I could easily do
what I'm asking but I'm trying to save some steps.
Does anyone have any logic advice for processing?
Thanks in advance!
Aaron