jcook Posted January 28, 2003 Share Posted January 28, 2003 I need a little help with understanding the proper way to have an input field to create a variable called $nbr_tracks. The situation is I have an input field when a product is added, not edited, in the /admin/categories.php where the user will enter number of tracks to add to the cd tracks for the new product. I want to take the number entered and insert new records in a table called cd_tracks, already defined as TABLE_CD_TRACKS. The column in this table are cd_tracks_id (auto incremented), products_id, track_nbr, song_title and artist_name. The steps in inserting new records would be an array called cd_tracks_array with the keys: products_id, track_nbr, song_title and artist_name and I would fill in the values using a for/next loop and the code would look something like this: for($i=1; $i <= $nbr_tracks, $i++) { cd_tracks_array = array( 'product_id'=> ' ', 'track_nbr' => $i, 'song_title => ' ', 'artist_name => ' '); tep_db_perform(TABLE_CD_TRACKS, $cd_tracks_array, 'insert'); } The above code should happen when the user clicks the preview button. So far, I have code in /admin/categories.php that's apparent'y not correct: <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_PRICE; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price', $pInfo->products_price); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td> </tr> (my code begins here): <?php $parent_id = strtok($HTTP_GET_VARS['cPath'], "_"); if(!$HTTP_GET_VARS['pID']) { if($parent_id == 2) { ?> <tr> <td class="main"><?php echo TEXT_PRODUCTS_NBR_TRACKS;?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('add_nbr_cd_tracks', '0', 'SIZE="2"');?></td> </tr> <?php } } ?> Any help would be appreciated. :) James Cook SELECT * FROM users WHERE clue > 0 GO (0 records returned) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.