We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

I can POST from voiceXML, but I can't pick up namelist varia

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
prairieblue
Posts: 10
Joined: Sat Nov 22, 2003 1:15 am

I can POST from voiceXML, but I can't pick up namelist varia

Post by prairieblue »

Here are a couple of code snippets:
voiceXML code:
<subdialog name="result" src="#getdriverslicense" namelist="myname">
<param name="birthday" expr="'February 10th, 1970'"/>
<filled>You entered <value expr="result.drivelicense"/>.
<submit next="http://prairieblue.com/vxml/base/TestResponse.php"
method="post"
namelist="result.drivelicense birthday"/>
</filled>
</subdialog>

corresponding php code:
if (isset($_POST['birthday'])) ProcessFormSet();
if (!isset($_POST['birthday'])) ProcessFormClr();

The code always executes the !isset path, ProcessFormClr();

Do you have an example of a matched pair of XML/php code that connects better than this?

Thanks.

prairieblue
Posts: 10
Joined: Sat Nov 22, 2003 1:15 am

I found some code that got me going again

Post by prairieblue »

I found a nice exapmple of VoiceXML POST and php response in:
"playing back multiple audio files for numbers"
in this forum.

I think that my problem was in variable definition.

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR code for submitting POST data to php script

Post by support »

As per your previous IVR Post, here is the vxml that <submit>s POST data to a php script named get_phone.php:

Code: Select all

<?xml version="1.0"?> 
<vxml version="2.0"> 

<var name="phone_number" expr="'6173246879'"/> 

<form id="test_form"> 
  <block> 
     <submit next="get_phone.php" method="GET" namelist="phone_number"/> 
  </block> 
</form> 
<vxml/> 

and here is the php code for get_phone.php:

Code: Select all

<?xml version="1.0"?> 
<vxml version="2.0"> 

<?php 
  //retrieve the full name from the POST variable 
  $phone = $_POST[phone_number']; 

  if(!$phone){
    //here we place code to execute if the post variable isn't set
  }
?> 

<!-- here we populate the vxml variable using the data 
       we pulled from the POST variable --> 
<var name="phone_number" expr="'<?php echo $phone ?>'"/> 


<form id="test_form"> 
  <block> 
    The phone number is<value expr="phone_number"/>, welcome! 
  </block> 
</form> 
<vxml/> 

hope this helps! :lol:

Post Reply