post to array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
BrettCarr
Forum Newbie
Posts: 22
Joined: Fri Feb 12, 2010 6:45 pm

post to array

Post 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'];
    }
    
}
    
?>
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: post to array

Post 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?
(#10850)
Post Reply