Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require ("conn.php");
- // Reads the variables sent via POST from our gateway
- $sessionId = $_POST[""];
- $serviceCode = $_POST["*384*2862#"];
- $phoneNumber = $_POST[""];
- $text = $_POST["text"];
- switch ($text) {
- case "":
- // This is the first request.
- //getting divisons from DB
- $sql = "SELECT * FROM divisions";
- $result = $conn->query($sql);
- $response = "CON Select your division n";
- while ($row = $result->fetch_array(MYSQLI_ASSOC)){
- $id = $row['id'];
- $name = $row['name'];
- $response .= "$id. $name n";
- }
- break;
- case "1":
- //This will be called when the user selects 1 want to know the value of name variable for 1
- $response = "CON Select a service you want to report for $name n";
- $response .= "1. Road Maintence n";
- $response .= "2. Drainage works n";
- break;
- default:
- $response = "END Sorry code not found";
- }
- header('Content-type: text/plain');
- echo $response;
- $servername = "localhost";
- $username = "praise_ussd";
- $password = "";
- $dbname = "praise_ussd";
- $conn = new mysqli($servername, $username, $password, $dbname);
Add Comment
Please, Sign In to add comment