'Troubles with recovering and echo or printing $_GET
So I'm having troubles with $_GET.
I cant seem to recover and echo or print the $_POST from my form in a different .php file (im using codeigniter4 btw). Can someone help? thank you
This is the code for "echoing" the $_GET in a different file (this is all inside an if statement with isset($_GET['variable'])
$name = $_GET["name"];
$email = $_GET["email"];
$suggestions = $_GET["suggestions"];
$output = "Name: " . $name . "\n";
$output .= "Email: " . $email . "\n";
$output .= "Suggestions: " . $suggestions;
echo $output;
This is my controller code
$data =
[
'name',
'email',
'suggestions',
'accept_terms'
];
if($this->request->getMethod() == 'post')
{
$rules =
[
'name' => 'required',
'email' => 'required|valid_email',
'suggestions' => 'required',
'accept_terms' => 'required',
];
if($this->validate($rules))
{
return redirect()->to('/Savefeedback');
}else
{
$data['validation'] = $this->validator;
}
}
return view('Signup',$data);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
