So I have this "client" PHP page, and a "server" PHP page. And I'm trying to send a value from the client to the server using the GET-method. And then I want to send the information back again from the server to the client and display it. How do I accomplish this?
At first the client page contains merely a link to the server page that also sends some information with it. E.g: <a href="server.php?firstname=myfirstname&lastname=nylastname">link</a>
But when the server has sent back the data, I do not want to display the link anymore. I just want to show the information, something like:
first name: myfirstname
last name: mylastname
How do I accomplish this? After doing some research I found this redirect function, but I'm not sure if I can or if I should use it:
function redirect($url, $statusCode = 303){
header('Location: ' . $url, true, $statusCode);
die();
}
And if I should use it: How do I send the data that I need back to the client with it using GET? Can I just do something like:
<?php
$firstname = $_GET["firstname"];
$lastname = $_GET["lastname"];
redirect("client.php?firstname=$firstname&lastname=$lastname") //I'm guessing putting the variables in like this doesn't work...
function redirect($url, $statusCode = 303){
header('Location: ' . $url, true, $statusCode);
die();
}
?>
But even if this works. I still don't know how to change the appearance of the client page when I send back the data from the server page. Is it even possible?
Oh: And I want to send the information back to the client as the MIME type text/plain