eldan88 Posted December 24, 2013 Share Posted December 24, 2013 Hey Guys. I am working on an API for automated voice application. I was just wondering if it is possible to send a URL value with out assigning anything to it. For example if someone presses a key on their telephone keypad, the application will go the following url <Gather action=\"confirmation_verificationphp?est_delivery_time\"> The "delivery_time" is not assigned to anything, I just want PHP to preform a set of actions when it gets the "delivery_time" Below is a clear example // When user enters a number on their telephone keypad it will go to "confirmation_verification.php?delivery_time" echo "<Gather action=\"confirmation_verification.php?delivery_time\" method=\"GET\" timeout=\"10\" finishOnKey=\"*\">"; echo say("Please enter your estimated delivery time"); echo "</Gather>"; Preform the set of actions when you get "delivery_time" if($_GET['delivery_time']) { $delivery_time = $_GET['Digits']; send_order_confirmation_email($order_number, $delivery_time ); } Link to comment https://forums.phpfreaks.com/topic/284917-passing-a-values-in-url/ Share on other sites More sharing options...
JIXO Posted December 24, 2013 Share Posted December 24, 2013 It is possible, but you need the isset() method, your if condition will always be false if you do not assign a value to 'delivery_time' : if($_GET['delivery_time']) {$delivery_time = $_GET['Digits'];send_order_confirmation_email($order_number, $delivery_time );} Instead use if(isset($_GET['delivery_time'])) Link to comment https://forums.phpfreaks.com/topic/284917-passing-a-values-in-url/#findComment-1463052 Share on other sites More sharing options...
kicken Posted December 24, 2013 Share Posted December 24, 2013 You could also compare $_SERVER['QUERY_STRING'] to values, eg: switch ($_SERVER['QUERY_STRING']){ case 'delivery_time': //do stuff case 'something_else': //do other stuff ... } Link to comment https://forums.phpfreaks.com/topic/284917-passing-a-values-in-url/#findComment-1463054 Share on other sites More sharing options...
eldan88 Posted December 25, 2013 Author Share Posted December 25, 2013 Jixo. Thanks a lot for your reply! Makes sense. Kicken. As always thanks for the informative information. I really like that approach! Link to comment https://forums.phpfreaks.com/topic/284917-passing-a-values-in-url/#findComment-1463076 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.