There’s like a million different ways to complete this task.
This is one of them : Use php fsockopen function to connect to the Asterisk AMI, then use the AMI Originate Action to initiate the call, On the Asterisk dial plan side use the Read() app (It Read a variable in the form for DTMF tones as pressed by the caller).
On the DB part you , Use MYSQL and the Asterisk System() command to save the data on the DB.
Related to share some sample code , this is a support community where members exchange thoughts and provide general support, The request of custom codes or samples code. Must be addrssed on the job section.
In case some member is willing to share some sample code, it is an extra mile.
[mysql_autodialer]
Description = MySql connection for autodialer database
Driver = MySql
Trace = No
Server = localhost
port = 3306
database = MyDatabase
user = MyUser
password = MyPassword
You would have to modify res_odbc.conf to create an entry for your ODBC connection.