How can the echo statement be used in PHP to correctly display values passed from a homepage?

When passing values from a homepage to a PHP script, you can use the $_GET or $_POST superglobals to retrieve the values. To display these values using the echo statement, you need to access the specific key of the passed value in the superglobal array. For example, if a value is passed with the key 'name', you can display it by using echo $_GET['name'] or echo $_POST['name'] depending on the method used to pass the value.

<?php
// Assuming 'name' is passed from the homepage using GET method
if(isset($_GET['name'])){
    echo "Welcome, " . $_GET['name'];
}
?>