jeudi 2 février 2017

multiple php if/else if statements

im building a facebook chatbot. however i dont think i have my if statements setup correctly. the second if statement asking about the website works but the first one with the greetings doesnt. i'm guessing my if/else statements aren't looping or set-up properly.

if(preg_match('[how are you|how you doing|sup|how u|hi|hello|hey|sup|whats up]', strtolower($message))) {

    $message_to_reply = 'Hello! Thank you for contacting gang&lani productions- your marketing superheroes! How can we help you today?';
    if($result != '') {
        $message_to_reply = $result;
    }
} else {
    $message_to_reply = 'Sorry, not sure if I understand correctly. Please email us at askus@gandlp.com to get more info!';
}
if(preg_match('[web dev|looking for website|looking to have website made|how much for a website|web design|need a website|website design|website|websie]', strtolower($message))) {

    $message_to_reply = 'Websites can vary depending on the scope of the project and what type of website you are looking for specifcally. At gang&lani proudctions, we specialize in high quality covnerting websites that will wow your viewsers and increase sales! Email us or call us at blah to get your special website started!';
    if($result != '') {
        $message_to_reply = $result;
    }
} else {
    $message_to_reply = 'Sorry, not sure if I understand correctly. Please email us at askus@gandlp.com to get more info!';
}

Aucun commentaire:

Enregistrer un commentaire