•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,743 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,533 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 921 | Replies: 1
![]() |
•
•
Join Date: Jul 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi all,
I'm having some trouble getting my php code to work properly. I'm submitting three different variables from a vxml form to my php. I then need the php to deposit the variables into files and update a mysql database accordingly, but it's not quite doing what I want it to.
The code is run from a webserver via an AIX server.
Here's my php code that I got so far:
<?php
header('Content-type: application:voicexml+xml; charset=iso-8859-1');
header('Content-Encoding: iso-8859-1');
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
echo "<vxml version=\"2.1\" xmlns=\"http://www.w3.org/2001/vxml\" xml:lang=\"en-GB\">";
echo "<property name=\"inputmodes\" value=\"dtmf\"/>";
echo "<form>";
echo "<block>";
$msg = "";
$msg2 = "";
$code = 1;
$wavName = "";
$wavAudition = "";
$number = "";
$tmpFile=$HTTP_POST_FILES['rec_name']['tmp_name'];
if (is_uploaded_file($tmpFile)) {
$wavName="/name/".date("YmdHis").".wav";
copy($tmpFile, sprintf("%s", $wavName));
$msg = "audio saved";
echo "saved name";
} else {
$code = 0;
$msg = "unable to save audio";
echo "not saved";
}
$tmpFile=$HTTP_POST_FILES['rec_audition']['tmp_name'];
if (is_uploaded_file($tmpFile)) {
$wavAudition = "audition/".date("YmdHis").".wav";
copy($tmpFile, sprintf("%s", $wavAudition));
$msg2 = "audio saved";
echo "saved audition";
} else {
$code = 0;
$msg2 = "unable to save audio";
echo "not saved";
}
$tmpFile = $HTTP_POST_FILES['contact_number']['tmp_name'];
if (is_uploaded_file($tmpFile)) {
copy($tmpFile, sprintf("%s", $number);
}
$con = mysql_connect("localhost","username","password");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("Database Name", $con);
$callDate = date("Ymd");
$callTime = date("His");
$sql="INSERT INTO table (calContactDir, calContactNum, calAuditionDir, calDate, calTime)
VALUES
('$wavName','$number','$wavAudition', '$callDate', '$callTime')";
if (!mysql_query($sql,$con)) {
die('Error: ' . mysql_error());
}
$sql="SELECT calUniqueID FROM Caller WHERE calContactDir = '$wavName'";
$uniqueID = mysql_query($sql,$con);
mysql_close($con);
echo "<audio src=\"file:///170.wav\" maxage=\"0\"/>";
echo "<prompt>$callDate</prompt>";
echo "<audio src=\"file:///171.wav\" maxage=\"0\"/>";
echo "<prompt>$uniqueID</prompt>";
echo "<goto next=\"file:///Audition_test.vxml#closing\"/>";
echo "</block>";
echo "</form>";
echo "</vxml>";
?>
The files are submitted with the following line of code:
Code: ( text )
1.
<submit next="submit.php" namelist="rec_name contact_number rec_audition" method="POST" enctype="multipart/form-data"/>
The problem is that it isn't depositing the variables into files and it's only inserting values into the time and date sections of the mysql database.
I have removed certain elements of the code as I'm under a Non Disclosure Agreement concerning the application and I don't want to place our database details, etc. out in the open (hope no one minds).
If anyone could help me out that would be greatly appreciated.
I'm having some trouble getting my php code to work properly. I'm submitting three different variables from a vxml form to my php. I then need the php to deposit the variables into files and update a mysql database accordingly, but it's not quite doing what I want it to.
The code is run from a webserver via an AIX server.
Here's my php code that I got so far:
<?php
header('Content-type: application:voicexml+xml; charset=iso-8859-1');
header('Content-Encoding: iso-8859-1');
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
echo "<vxml version=\"2.1\" xmlns=\"http://www.w3.org/2001/vxml\" xml:lang=\"en-GB\">";
echo "<property name=\"inputmodes\" value=\"dtmf\"/>";
echo "<form>";
echo "<block>";
$msg = "";
$msg2 = "";
$code = 1;
$wavName = "";
$wavAudition = "";
$number = "";
$tmpFile=$HTTP_POST_FILES['rec_name']['tmp_name'];
if (is_uploaded_file($tmpFile)) {
$wavName="/name/".date("YmdHis").".wav";
copy($tmpFile, sprintf("%s", $wavName));
$msg = "audio saved";
echo "saved name";
} else {
$code = 0;
$msg = "unable to save audio";
echo "not saved";
}
$tmpFile=$HTTP_POST_FILES['rec_audition']['tmp_name'];
if (is_uploaded_file($tmpFile)) {
$wavAudition = "audition/".date("YmdHis").".wav";
copy($tmpFile, sprintf("%s", $wavAudition));
$msg2 = "audio saved";
echo "saved audition";
} else {
$code = 0;
$msg2 = "unable to save audio";
echo "not saved";
}
$tmpFile = $HTTP_POST_FILES['contact_number']['tmp_name'];
if (is_uploaded_file($tmpFile)) {
copy($tmpFile, sprintf("%s", $number);
}
$con = mysql_connect("localhost","username","password");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("Database Name", $con);
$callDate = date("Ymd");
$callTime = date("His");
$sql="INSERT INTO table (calContactDir, calContactNum, calAuditionDir, calDate, calTime)
VALUES
('$wavName','$number','$wavAudition', '$callDate', '$callTime')";
if (!mysql_query($sql,$con)) {
die('Error: ' . mysql_error());
}
$sql="SELECT calUniqueID FROM Caller WHERE calContactDir = '$wavName'";
$uniqueID = mysql_query($sql,$con);
mysql_close($con);
echo "<audio src=\"file:///170.wav\" maxage=\"0\"/>";
echo "<prompt>$callDate</prompt>";
echo "<audio src=\"file:///171.wav\" maxage=\"0\"/>";
echo "<prompt>$uniqueID</prompt>";
echo "<goto next=\"file:///Audition_test.vxml#closing\"/>";
echo "</block>";
echo "</form>";
echo "</vxml>";
?>
The files are submitted with the following line of code:
Code: ( text )
1.
<submit next="submit.php" namelist="rec_name contact_number rec_audition" method="POST" enctype="multipart/form-data"/>
The problem is that it isn't depositing the variables into files and it's only inserting values into the time and date sections of the mysql database.
I have removed certain elements of the code as I'm under a Non Disclosure Agreement concerning the application and I don't want to place our database details, etc. out in the open (hope no one minds).
If anyone could help me out that would be greatly appreciated.
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- fstream Tutorial (C++)
- how to set the multiple submit button in asp (ASP)
- Question about html form image submit value (HTML and CSS)
- Long String (C++)
- Winsock Multi-Client Servers (C++)
Other Threads in the PHP Forum
- Previous Thread: printing to the screen after using fopen()
- Next Thread: Where we can use curl ?


Linear Mode