I'm having trouble passing information into my SQL database using php. The script works fine with my web form, but doesnt seem to pass information to my database when i use it with plumvoice. I'm trying to configure the tutorial just to make sure it will interface with my database.
the table has two specific receivers
license_number VARCHAR (30)
and
request_type VARCHAR(30)
Here is my start.php
Code: Select all
<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>\n";
?>
<vxml version="2.0">
<var name="license_number"/>
<var name="request_type"/>
<form>
<field name="license" type="digits">
<prompt>
Please enter your license number
</prompt>
<filled>
<assign name="license_number" expr="license"/>
</filled>
</field>
<field name="request">
<grammar type="application/srgs+xml" mode="dtmf" root="choice" maxdigits="1">
<rule id="choice">
<one-of>
<item>1</item>
<item>2</item>
</one-of>
</rule>
</grammar>
<prompt>
To renew your license, press 1. To request a new license plate, press 2.
</prompt>
<filled>
<assign name="request_type" expr="request"/>
<submit next="process_request.php" method="post" namelist="
license_number request_type" fetchtimeout="60s"/>
</filled>
</field>
</form>
</vxml>
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
// get the variables posted to this script
$name = $_POST['license_number'];
$license = $_POST['request_type'];
// here we could process the data by entering the information into a database or calling a webservice
$con = mysql_connect("provider","database","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db629980542", $con);
$sql="INSERT INTO request (license_number, request_type)
VALUES
('$license','$name')";
?>
<vxml version="2.0">
<form>
<block>
<prompt>
Thank you. We will process your request and get back to you shortly. Goodbye.
</prompt>
<exit/>
</block>
</form>
</vxml>