I'm trying to make a flag as a switch "true and false" when the user has clicked the request order button the flag value changing to the "true" and then when the user sent "message" into the chatbot and the flag is true, print work.
$flag = false;
if ($text == '/start')
{
$key = json_encode([ 'inline_keyboard'=> [ [ ['text'=>'view order','callback_data'=>'vOrder'],['text'=>'request order','callback_data'=>'rOrder'] ] ] ]);
bot('sendMessage',['chat_id'=>$chatID,'text'=>'start order','reply_markup'=>$key]);
}
switch ($data) {
case "rOrder":
$key = json_encode([ 'inline_keyboard'=> [ [ ['text'=>'cancel the order','callback_data'=>'cnl'] ] ] ]);
bot('sendMessage',['chat_id'=>$chatID2,'text'=>'1/2
write describe about your order',
'reply_markup'=>$key]);
bot('sendMessage',['chat_id'=>$chatID2,'text'=>$order]);
$flag = true;
break;
case "vOrder":
bot('sendMessage',['chat_id'=>$chatID2,'text'=>$viewOrder]);
break;
}
if(!empty($text) and $flag==true){
bot('sendMessage',['chat_id'=>$chatID,'text'=>'work']);
}
Just I want to receive information from the user after has clicked the button other else no