user1614526 user1614526 - 4 months ago 39
PHP Question

PHP :passing message along header location

I would like to show a message on the page once the user enter some wrong data

so far I am passing a message like

$Message = "Some error occured please try after some time ";
header("Location:index.php?Message={$Message}");


I know this message will display only in address bar so what should I do so that this message could display on the index.php page instead of this

http://localhost/UI/index.php?Message=Someerror occured please try after some time

Answer

What about:

if( !empty( $_REQUEST['Message'] ) )
{
    echo sprintf( '<p>%s</p>', $_REQUEST['Message'] );
}

???