Fork me on GitHub

first entry in array being replaced  Bottom

  • Okay i'm pullin my hair out here, maybe someone else can see why the first entry in the form output is being replaced.

    Code

    foreach($race as $val) {
            $car = $val['3'];
            $car_uid = pnModAPIFunc('Nascar','user','get_data_by_car',array('car'=>$car));
            $driver[name] = pnUserGetVar('uname', $car_uid);
            if (empty($driver['name'])) {
                $driver['name'] = "<b>Not Found</b>";
                $errors_found = true;
            }
            // recalculate the points
            list($val['8'],$bonus) = pnModAPIFunc('Nascar','admin','calc_points',array('finish'=>$val[1],'led'=>$val[7]));
            // Finish Position
            if ($val['1'] == 99) {
                $val['1'] = "PROV";
            }
            $row = array();
            $output->FormHidden("race[".$val['1']."][1]", $val['1']);
            $row[] =  $val['1'];    // Finish
            $output->FormHidden("race[".$val['1']."][2]", $val['2']);
            $row[] =  $val['2'];    // Start
            $output->FormHidden("race[".$val['1']."][3]", $val['3']);
            $row[] =  $val['3'];    // Car #
            $output->FormHidden("race[".$val['1']."][4]", $car_uid);
            $row[] =  "".$driver['name']."(".$val[4].")";    // Driver
            $output->FormHidden("race[".$val['1']."][5]", $val['5']);
            $row[] =  $val['5'];    // Interval
            $output->FormHidden("race[".$val['1']."][6]", $val['6']);
            $row[] =  $val['6'];    // Laps
            $output->FormHidden("race[".$val['1']."][7]", $val['7']);
            $row[] =  $val['7'];    // Led 
            $output->FormHidden("race[".$val['1']."][8]", $val['8']);
            $row[] =  $val['8'];    // Points
            $output->FormHidden("race[".$val['1']."][9]", $val['9']);
            $row[] =  $val['9'];    // Status
            $output->FormHidden("race[".$val['1']."][10]", $val['10']);
            $row[] =  $val['10'];   // Qual            
           
        $output->SetOutputMode(_PNH_KEEPOUTPUT);
        $output->SetInputMode(_PNH_VERBATIMINPUT);
        $output->TableAddrow($row, 'center');
        $output->SetInputMode(_PNH_PARSEINPUT);
           
        }


    basically this takes the information from $race which is multidimensional array with the driver finish information for each driver in an internal array. it this figures bonus points etc.... it all works great so far except when i try to post it to the next function for database entry, it doesn't have the first entry in it. goes right to 2
  • nevermind for some reason it's not creating the hidden form entry for the first set of variables

This list is based on users active over the last 60 minutes.