Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

PHP code sending Phone verification code

Hello

I'm a bigginer level programmer am Trying to build a form by PHP that sends a message with a code to my phone number, below is a code i wrote and some of it i toke from php.net, but when i upload it to my server it dosen't send anything , please tell me what i missed?!! <?php require("call.php"); require('Twilio.php'); require("database.php");

$sender_name = $_POST['name']; $sender_email = $_POST['email']; $sender_orgnization = $_POST['orgnization']; $number = $_POST['number']; $message = $_POST['message']; $rateDisclaimer = "Data rates may apply";

$subject = $sender_name . " liluweb";

mail($sender_name.$sender_email.$number.$subject, "\r\n\n".$message."\r\n\n".$rateDisclaimer);

echo "Message sent";

?>

<html> <head> <title>Register</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href=""> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="connect.js"></script> <?php $(document).ready(function(){ $("+380681496448").submit(function(e) { e.preventDefault(); initiateCall(); }); });

  function initiateCall() {
    $.post("call.php", { phone_number : $("+380681496448").val() }, 
      function(data) { showCodeForm(data.verification_code); }, "json");
    checkStatus();
  }

  function showCodeForm(code) {
    $("#verification_code").text(code);
    $("#verify_code").fadeIn();
    $("#enter_number").fadeOut();
  }

  function checkStatus() {
    $.post("status.php", { phone_number : $("#phone_number").val() }, 
      function(data) { updateStatus(data.status); }, "json");
  }

  function updateStatus(current) {
    if (current === "unverified") {
      $("#status").append(".");
      setTimeout(checkStatus, 3000);
    }
    else {
      success(); 
    }
  }

  function success() {
    $("#status").text("Verified!");
  }
    ?>

</head>

<body> <div class="container"> <div class="col-md-6"> <form name="form" type="container" action="" method="post"> <table> <tr> <td>First Name</td> <td><input type="text" name="t1" pattern="^[A-Za-z]+"></td> <td>Orgnization</td> <td><input type="text" name="t2"></td> </tr> <tr> <td>Email*</td> <td><input type="text" name="t3"></td> <td>Phone</td> <td><input type="text" name="t4" ></td> </tr> <tr> <td>Select verification Method</td> <td><input type="Radio" value="Phone" name="r1">Phone<input type="radio" value="Email" name="r1">Email</td> </tr> <td>Permission reuest <td><textarea name="comment" rows="5" cols="40"></textarea></td> </td> </tr> <td colspan="2" align="center"> <input type="submit" align="left" name="submit" value="Submit"> <tr> <div class="form-group"> </form> </div> </div> </table> </body> </html>

This is the code i wrote