473,396 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Handling a multiple submit from VXML

1
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:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. header('Content-type: application:voicexml+xml; charset=iso-8859-1');
  4. header('Content-Encoding: iso-8859-1');
  5.  
  6. echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
  7. echo "<vxml version=\"2.1\" xmlns=\"http://www.w3.org/2001/vxml\" xml:lang=\"en-GB\">";
  8. echo "<property name=\"inputmodes\" value=\"dtmf\"/>";
  9. echo "<form>";
  10. echo "<block>";
  11.  
  12. $msg = "";
  13. $msg2 = "";
  14. $code = 1;
  15. $wavName = "";
  16. $wavAudition = "";
  17. $number = "";
  18.  
  19. $tmpFile=$HTTP_POST_FILES['rec_name']['tmp_name'];
  20.  
  21. if (is_uploaded_file($tmpFile)) {
  22.     $wavName="/name/".date("YmdHis").".wav";
  23.     copy($tmpFile, sprintf("%s", $wavName));
  24.     $msg = "audio saved";
  25.     echo "saved name";
  26.  
  27. } else {
  28.     $code = 0;
  29.     $msg = "unable to save audio";
  30.     echo "not saved";
  31. }
  32.  
  33. $tmpFile=$HTTP_POST_FILES['rec_audition']['tmp_name'];
  34.  
  35. if (is_uploaded_file($tmpFile)) {
  36.     $wavAudition = "audition/".date("YmdHis").".wav";
  37.     copy($tmpFile, sprintf("%s", $wavAudition));
  38.     $msg2 = "audio saved";
  39.     echo "saved audition";
  40.  
  41. } else {
  42.  
  43.     $code = 0;
  44.     $msg2 = "unable to save audio";
  45.     echo "not saved";
  46. }
  47.  
  48. $tmpFile = $HTTP_POST_FILES['contact_number']['tmp_name'];
  49.  
  50. if (is_uploaded_file($tmpFile)) {
  51.  
  52.     copy($tmpFile, sprintf("%s", $number);
  53.  
  54. }
  55.  
  56. $con = mysql_connect("localhost","username","password");
  57. if (!$con) {
  58.  
  59.   die('Could not connect: ' . mysql_error());
  60.  
  61. }
  62.  
  63. mysql_select_db("Database Name", $con);
  64.  
  65. $callDate = date("Ymd");
  66. $callTime = date("His");
  67.  
  68. $sql="INSERT INTO table (calContactDir, calContactNum, calAuditionDir, calDate, calTime)
  69. VALUES
  70. ('$wavName','$number','$wavAudition', '$callDate', '$callTime')";
  71.  
  72. if (!mysql_query($sql,$con)) {
  73.  
  74.   die('Error: ' . mysql_error());
  75.  
  76. }
  77.  
  78. $sql="SELECT calUniqueID FROM Caller WHERE calContactDir = '$wavName'";
  79.  
  80. $uniqueID = mysql_query($sql,$con);
  81.  
  82. mysql_close($con);
  83.  
  84. echo "<audio src=\"file:///170.wav\" maxage=\"0\"/>";
  85. echo "<prompt>$callDate</prompt>";
  86. echo "<audio src=\"file:///171.wav\" maxage=\"0\"/>";
  87. echo "<prompt>$uniqueID</prompt>";
  88. echo "<goto next=\"file:///Audition_test.vxml#closing\"/>";
  89.  
  90. echo "</block>";
  91. echo "</form>";
  92. echo "</vxml>";
  93.  
  94. ?>
  95.  
The files are submitted with the following line of code:

Expand|Select|Wrap|Line Numbers
  1. <submit next="submit.php" namelist="rec_name contact_number rec_audition" method="POST" enctype="multipart/form-data"/>
  2.  
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.

The parts of the code that are in italics are sections that I have removed 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.
Jul 2 '07 #1
0 1414

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Richard Kasperowski | last post by:
Boston Mobile is the Boston-area mobile software developers group. We are a community of people who build applications for mobile devices such as mobile phones, PDAs, and pocket PCs. We meet...
3
by: Tina | last post by:
I have an aspx page with a textbox and an "add to my Account Button." when the button is pushed, my program adds the amount in the textbox to the database which, lets say takes a few seconds. If...
0
by: stanna | last post by:
Hello, We are looking for XML/Soap/VxML experts to work in US as well as in India, If anybody is looking for job, send your resume to stanna at optonline dot net. Salaries are attractive. ...
0
by: polar086 | last post by:
Hi, For anyone that is familiar with vxml. Is there any way to recognize only part of a sentence, and disregard the rest? For example, I want to recognize "I grew up in *anything*", where...
5
by: c676228 | last post by:
Hi everyone, my colleagues are thinking about have three insurance plans on one asp page: I simplify the plan as follow: text box:number of people plan1 plan2 plan3
6
jenkinsloveschicken
by: jenkinsloveschicken | last post by:
I am developing a administrative backend for our sales dept website. They are using admin forms to manipulate what is displayed for the end user on the site. I am running into a problem with a form...
8
by: JWest46088 | last post by:
I'm having problems with my error handling. It's kind of hard to explain so I'll just post my code and bold where the error handling is and then explain what is happening. Just to warn you, I am...
0
by: dhyder | last post by:
I'm working on an admin page for a SQL Server 05 db. The page is in ASP.NET 2.0/C#. The db has multiple tables with foreign keys/constraints. I have multiple SqlDataSources and GridViews, which...
6
by: phpnewbie26 | last post by:
My current form has one multiple select drop down menu as well as few other drop down menus that are single select. Originally I had it so that the multiple select menu was first, but this created...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.