Page 1 of 1

post to array

Posted: Fri Feb 12, 2010 7:11 pm
by BrettCarr
Hi guys my first time in a forum
I need to add 35 records to an array, im new to arrays and arn't sure what im doing is right.
Once the use hits post i want him to be ables to veiw each record as it goes it array check they are right and then shoot them to mysql table and create csv file
I have eveything and that the adding off records to a array please help

Code: Select all

<?
class Batcharray extends Database 
{
    
    
    
    
    
    
    
    
    
    function getArrayData()
    {
        
                            $batch_date                 = $_POST['batch_date'];
                            $batch_number               = $_POST['batch_number'];
                            $original_proof_num         = $_POST['original_proof_num']; 
                            $batch_status               = $_POST['batch_status'];
                            $invoice_num_ccaus          = $_POST['invoice_num_ccaus'];
                            $carrier                    = $_POST['carrier'];
                            $num_of_boxes               = $_POST['num_of_boxes'];
                            $toll_consign_num               = $_POST['toll_consign_num'];
                            $custId                     = $_POST['custId'];
                            $venueId                    = $_POST['venueId'];
                            $bpay                       = $_POST['bpay'];
                            $proof_tracking_comments    = $_POST['proof_tracking_comments'];
                            $veunue_comments            = $_POST['veunue_comments'];
        
        
    $i = -1;
        
        
        
        $batchlist = array( "batcharray" =>  array( "batch_date"                =>  $batch_date,
                                                    "batch_number"              =>  $batch_number ,
                                                    "original_proof_num"        =>  $original_proof_num,    
                                                    "batch_status"              =>  $batch_status,
                                                    "invoice_num_ccaus"         =>  $invoice_num_ccaus,
                                                    "carrier"                   =>  $carrier,
                                                    "num_of_boxes"              =>  $num_of_boxes,
                                                    "toll_consign_num"          =>  $toll_consign_num ,
                                                    "custId"                    =>  $custId ,
                                                    "venueId"                   =>  $venueId,
                                                    "bpay"                      =>  $bpay,
                                                    "proof_tracking_comments"   =>  $proof_tracking_comments,
                                                    "veunue_comments"           =>  $veunue_comments,
                                         )
                                    );
                                    
                                    
                                    
                                    
                         $batcharray1 =      array( "batch_date"                =>  $batch_date,
                                                    "batch_number"              =>  $batch_number ,
                                                    "original_proof_num"        =>  $original_proof_num,    
                                                    "batch_status"              =>  $batch_status,
                                                    "invoice_num_ccaus"         =>  $invoice_num_ccaus,
                                                    "carrier"                   =>  $carrier,
                                                    "num_of_boxes"              =>  $num_of_boxes,
                                                    "toll_consign_num"          =>  $toll_consign_num ,
                                                    "custId"                    =>  $custId ,
                                                    "venueId"                   =>  $venueId,
                                                    "bpay"                      =>  $bpay,
                                                    "proof_tracking_comments"   =>  $proof_tracking_comments,
                                                    "veunue_comments"           =>  $veunue_comments,
                                         );                     
                                    
                    $batchlist = array_merge($batchlist, $batcharray1);
                    print_r($batchlist);
            
                                                
                    foreach( $batchlist["batcharray"] as $key => $value)
                    {
                        echo "$key, $value <br />";
                    }
            
                echo $batchlist["batcharray"]['venueId'];
    }
    
}
    
?>

Re: post to array

Posted: Fri Feb 12, 2010 8:13 pm
by Christopher
It is not clear what is not working and what the next thing you need to make work? Does the code above properly add the post data to your array? What does the form look like? Do you want to save the post data to a database? Or save to a CSV file?