Link to home
Start Free TrialLog in
Avatar of Fin Vangelis
Fin Vangelis

asked on

php ajax html dynamic record handling

I have an html form.
I have the following php script.
 
The  saveVisit function below is one record.
I could have 1 or up to 6 records.

I am executing php with ajax.
How do I create the html form fields to allow for easy handling of dynamic records?
Also the same applies for my php to allow for dynamically handling record in server.



        function processEachVisit(){
            //loop through each visit

            //execute saveVisit query

        };



        //function to save each visit.
        function saveVisit($dbconn, $providerID, $clientId, $visitStart, $visitEnd, $visitUnits, $visitMinutes, $visitActvities, $visitComments){
            $Query = 'INSERT INTO serviceRendered (clientId, visitStart, visitEnd) VALUES
                      ( $1, $2, $3 ) RETURNING id';

            $result = pg_query_params($dbconn, $Query, array(clientId, visitStart, visitEnd));

            $row = pg_fetch_row($result);

            return $row['0'];

        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Fin Vangelis
Fin Vangelis

ASKER

Thanks this is what I needed.
Thanks this is what I needed.