I'm setting up a simple script to send SMS through Twillio, and record the messages in the database. All the code runs fine until I add an IF statement.
A form is used to enter the phone number and message, which is sent (POST) to the process.php file, which send the message through the Twillio API and logs it in the database.
I'm pretty good with PHP, it's a very basic IF statement I have used thousands of times before, but this 500 error has me stumped.
if(isset($_POST['phone_number'])) {
$sms_to = $_POST['phone_number'];
$sms_body = $_POST['sms_message'];
require_once '../vendor/autoload.php';
... Lots more code
} else {
echo "Sorry, message not sent. No phone number was entered.";
}
I have triple checked all the code to make sure there was no errors, which it does run fine, until I add the if statement.