Jump to content

how to dial a phone # with a cell phone using a mysql database: php wtai mysql


Guest kbzero

Recommended Posts

I had the hardest time finding this myself, but FINALLY got something to work...........

Here was the problem: I had developed a mysql contact management database with PHP scripts to communicate with it.... I have internet access on my cell phone (verizon) so I can get into this database anywhere ....

I wanted to be able to AUTOMATICALLY DIAL THE PHONE NUMBERS stored in the database just by selecting the link for the desired phone number....

In other words I may have a list of 5 phone numbers, I wanted to have them hyperlinked, and then when I selected the link, the phone automatically dialed the number.



SO HERE IS HOW I DID IT: I was not able to use a hyperlink in my PHP code itself... However I was able to use basic forms, automatically pre - fill each form field with the phone number this comes from the SQL database - then have a button that submits the entire form to a script that turns the phone numbers into variables, and redisplays them ready to dial.... I select the appropriate number, and select the link and the phone dials it~!

First script: searchname.php  Get output from database:

<?php
if (!isset($_POST['name'])) {die();}
$name = $_POST['name'];
$field = $_POST['field'];


$query  = "SELECT * FROM main where $field LIKE '%$name%' ORDER BY lastname ASC LIMIT 0, 30";
$result = mysql_query($query);
echo '<FONT FACE="arial">' ;

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{


echo "id:  {$row['id']} <br>" .
"Name:  <B>{$row['firstname']} {$row['lastname']} {$row['middleinitial']}.<br></B>" .
"company:  {$row['company']} <br>" .
"spousefirstname:  {$row['spousefirstname']} <br>" .
"spousemiddleinitial:  {$row['spousemiddleinitial']} <br>" .
"spouselastname:  {$row['spouselastname']} <br>" .
"spousecompany:  {$row['spousecompany']} <br>" .
'<form method="POST" action="http://www.DOMAIN.com/wtaigen.php">' .
'<input type="submit" value="Dial"><BR>' .
"Work" .
'<input type="text" name="phnuma" size="10" value="' .
"{$row['workphone']}" .
'"><BR>' .
"Home" .
'<input type="text" name="phnumb" size="10" value="' .
"{$row['homephone']}" .
'"><BR>' .
"Cell" .
'<input type="text" name="phnumc" size="10" value="' .
"{$row['cellphone']}" .
'"><BR>' .
"Cell2" .
'<input type="text" name="phnumd" size="10" value="' .
"{$row['cell2phone']}" .
'"><BR>' .
"Fax1" .
'<input type="text" name="phnume" size="10" value="' .
"{$row['fax1phone']}" .
'"><BR>' .
"Fax2" .
'<input type="text" name="phnumf" size="10" value="' .
"{$row['fax2phone']}" .
'"><BR>' .
"SpFax1" .
'<input type="text" name="phnumg" size="10" value="' .
"{$row['spousefax1phone']}" .
'"><BR>' .
"SpFax2" .
'<input type="text" name="phnumh" size="10" value="' .
"{$row['spousefax2phone']}" .
'"><BR>' .
"Extra1" .
'<input type="text" name="phnumi" size="10" value="' .
"{$row['extra1phone']}" .
'"><BR>' .
"Extra2" .
'<input type="text" name="phnumj" size="10" value="' .
"{$row['extra2phone']}" .
'"><BR>' .
"Extra3" .
'<input type="text" name="phnumk" size="10" value="' .
"{$row['extra3phone']}" .
'"><BR>' .
"Extra4" .
'<input type="text" name="phnuml" size="10" value="' .
"{$row['extra4phone']}" .
'"><BR>' .
"email1:  {$row['email1']} <br>" .
"email2:  {$row['email2']} <br>" .
"email3:  {$row['email3']} <br>" .
"spouseemail1:  {$row['spouseemail1']} <br>" .
"spouseemail2:  {$row['spouseemail2']} <br>" .
"spouseemail3:  {$row['spouseemail3']} <br>" .
"homeaddress:  {$row['homeaddress']} <br>" .
"homecity:  {$row['homecity']} <br>" .
"homestate:  {$row['homestate']} <br>" .
"homezip:  {$row['homezip']} <br>" .
"workaddress:  {$row['workaddress']} <br>" .
"workcity:  {$row['workcity']} <br>" .
"workstate:  {$row['workstate']} <br>" .
"workzip:  {$row['workzip']} <br>" .
"mailaddress:  {$row['mailaddress']} <br>" .
"mailcity:  {$row['mailcity']} <br>" .
"mailstate:  {$row['mailstate']} <br>" .
"mailzip:  {$row['mailzip']} <br>" .
"cgroup:  {$row['cgroup']} <br>" .
"website:  {$row['website']} <br>" .
"notes:<br><br><!-- beginnotes -->{$row['notes']} <br></br><br>" ;


}

?>



SECOND SCRIPT: wtaigen.php : gets phone numbers from first script form submissions, and reformats the numbers ready to dial

<?php
if (!isset($_POST['phnuma'])) {die();}
$phnuma = $_POST['phnuma'];
$phmumb = $_POST['phmumb'];
$phmumc = $_POST['phmumc'];
$phmumd = $_POST['phmumd'];
$phmume = $_POST['phmume'];
$phmumf = $_POST['phmumf'];
$phmumg = $_POST['phmumg'];
$phmumh = $_POST['phmumh'];
$phmumi = $_POST['phmumi'];
$phmumj = $_POST['phmumj'];
$phmumk = $_POST['phmumk'];
$phmuml = $_POST['phmuml'];

echo "work: ";
echo "<anchor>$phnuma";
echo "<go href=\"wtai://wp/mc;$phnuma\"/><BR>";
echo "</anchor><BR>";
echo "Home: ";
echo "<anchor>$phnumb";
echo "<go href=\"wtai://wp/mc;$phnumb\"/><BR>";
echo "</anchor><BR>";
echo "Cell: ";
echo "<anchor>$phnumc";
echo "<go href=\"wtai://wp/mc;$phnumc\"/><BR>";
echo "</anchor><BR>";
echo "Cell2: ";
echo "<anchor>$phnumd";
echo "<go href=\"wtai://wp/mc;$phnumd\"/><BR>";
echo "</anchor><BR>";
echo "Fax1: ";
echo "<anchor>$phnume";
echo "<go href=\"wtai://wp/mc;$phnume\"/><BR>";
echo "</anchor><BR>";
echo "Fax2: ";
echo "<anchor>$phnumf";
echo "<go href=\"wtai://wp/mc;$phnumf\"/><BR>";
echo "</anchor><BR>";
echo "Spfax1: ";
echo "<anchor>$phnumg";
echo "<go href=\"wtai://wp/mc;$phnumg\"/><BR>";
echo "</anchor><BR>";
echo "Spfax2: ";
echo "<anchor>$phnumh";
echo "<go href=\"wtai://wp/mc;$phnumh\"/><BR>";
echo "</anchor><BR>";
echo "extra1: ";
echo "<anchor>$phnumi";
echo "<go href=\"wtai://wp/mc;$phnumi\"/><BR>";
echo "</anchor><BR>";
echo "extra2: ";
echo "<anchor>$phnumj";
echo "<go href=\"wtai://wp/mc;$phnumj\"/><BR>";
echo "</anchor><BR>";
echo "extra3: ";
echo "<anchor>$phnumk";
echo "<go href=\"wtai://wp/mc;$phnumk\"/><BR>";
echo "</anchor><BR>";
echo "extra4: ";
echo "<anchor>$phnuml";
echo "<go href=\"wtai://wp/mc;$phnuml\"/><BR>";
echo "</anchor><BR>";

die()

?>


I figured I have visited these sites to get help, and hopefully this will help someone else out there!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.