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

Redirect back to Plum from PHP file, not working

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
kishore.inline
Posts: 19
Joined: Mon Jun 21, 2010 4:00 am

Redirect back to Plum from PHP file, not working

Post by kishore.inline »

Hi All

I have wrttend code to validate the inputs in PHP file, ones call is validated, I have to redirect back to plum scratch pad, but call is getting hanged in PHP file.

The below is the code written by me... Please help me


<form id="clockin">
<field name="customerid" type="digits?length=4">
<prompt>
You have selected for Clock In.
</prompt>
<prompt>
Enter Client ID and press Hash to Submit.
</prompt>
<filled>
You entered <value expr="customerid"/>.
<prompt>
Please wait while we process your information.
</prompt>
<submit namelist="customerid" next="http://voicexcall.99k.org/TestVXML/CustomerID.php"/>
<goto next="#caretaker"/>

</filled>
<noinput>
Sorry, No Input received.
<reprompt/>
</noinput>
<nomatch>
Sorry, Invalid Client ID.
<reprompt/>
</nomatch>
</field>
<block>
Please hold for clockin.
</block>
</form>

<form id="caretaker">

<field name="caretakerid" type="digits?length=6">
<prompt>
Enter CareTaker ID and Password. Enter CareTakerID followed by Star then Password. And press Hash to Submit.
</prompt>
<filled>
You entered <value expr="caretakerid"/>.
<prompt>
Please wait while we process your information.
</prompt>
<submit namelist="caretakerid" next="http://voicexcall.99k.org/TestVXML/CareTakerID.php"/>
</filled>
<noinput>
Sorry, No Input received.
<reprompt/>
</noinput>
<nomatch>
Sorry, Invalid CareTaker ID.
<reprompt/>
</nomatch>
</field>
<block>
Please hold for clockin.
</block>



</form>
--------- PHP code----------------

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");

$customerid = $_GET[customerid];
?>

<vxml version="2.0">
<form>
<block>
<prompt>
Your Customer ID is <?php echo($customerid)?>.
</prompt>

</block>
</form>
</vxml>

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

Re: Redirect back to Plum from PHP file, not working

Post by support »

Hi,

In the case where you want to submit some data to another page, execute that other page, and then return to the parent document at the same point where you left off, you actually want to use the <subdialog> tag. If you are trying to use the subdialog (which in this case, is the PHP page) to validate a customerid, you might want to send some data back to the parent document that contains whether or not the customerid was valid. Then, you could do some branching based on the validity of the customerid. The following is an example using your code of how you would do this using a subdialog.

clockin.php

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0">
<form id="clockin">

<field name="customerid" type="digits?length=4">
<prompt>
You have selected for Clock In.
Enter Client ID and press Hash to Submit.
</prompt>

<filled>
<prompt>
You entered <value expr="customerid"/>.
Please wait while we process your information.
</prompt>
</filled>

<noinput>
Sorry, No Input received.
<reprompt/>
</noinput>
<nomatch>
Sorry, Invalid Client ID.
<reprompt/>
</nomatch>
</field>

<subdialog name="sendid" namelist="customerid" src="CustomerID.php">
<filled>
<if cond="sendid.confirmation=='verified'">
  <prompt>
    Your customer ID was verified.
  </prompt>
  <goto next="#caretaker"/>
<else/>
  <prompt>
    Your customer ID was not verified.
  </prompt>
  <clear namelist="sendid customerid clockin"/>
</if>
</filled>
</subdialog>
</form>

<form id="caretaker">

<field name="caretakerid" type="digits?length=6">
<prompt>
Enter CareTaker ID and Password. Enter CareTakerID followed by Star then Password. And press Hash to Submit.
</prompt>
<filled>
You entered <value expr="caretakerid"/>.
<prompt>
Please wait while we process your information.
</prompt>
<submit namelist="caretakerid" next="http://voicexcall.99k.org/TestVXML/CareTakerID.php"/>
</filled>
<noinput>
Sorry, No Input received.
<reprompt/>
</noinput>
<nomatch>
Sorry, Invalid CareTaker ID.
<reprompt/>
</nomatch>
</field>
<block>
Please hold for clockin.
</block>

</form>
</vxml>
CustomerID.php

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");

$customerid = $_GET[customerid];
$confirmation = "verified"; 
?>

<vxml version="2.0">
<form>
<block>
<var name="confirmation" expr="'<?php echo($confirmation)?>'"/>
<prompt>
Your Customer ID is <?php echo($customerid)?>.
</prompt>
<return namelist="confirmation"/>
</block>
</form>
</vxml>
In clockin.php, the line...

Code: Select all

<clear namelist="sendid customerid clockin"/>
...will clear out your variables, and effectively restart your application from the beginning.

Regards,
Plum Support

Post Reply