I have a website that when you submit two numbers i need to ensure that they both start correctly
how can i make it so if the first field say “from” must start with 07 and the to field must start 447 if one or both are incorrect i can echo a error message.
i know it will be an if statement but not sure how to do it as i need to make sure that when the details are posted they are correctly formatted.
i have tested it and it does echo what i want but how i can stop the script from continuing cause when i tested this it did echo what i wanted but continued with the script.
// Check if the form has been inputted correctly
if (!preg_match('/^447/', $to) || !preg_match('/^07/', $from))
{
echo "Please ensure you have entered the numbers correct";
exit();
}
else
{
// Continue
}