php request http code example

Example 1: php http method

$_SERVER['REQUEST_METHOD'];

Example 2: get http method php

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
     // The request is using the POST method
}

Example 3: what does $request do in php

$message = "";

if($_REQUEST['msg'] == "new"){
    $message = "New User has been added successfully";
}else if($_REQUEST['msg'] == 'edit'){
    $message = "User has been saved successfully";
}else if($_REQUEST['msg'] == 'update'){
    $message = "User(s) has been Updated successfully";
}

Tags:

Php Example