Closed robsonsobral closed 8 years ago
Depends on the kind of form. If it's a POST, you'll need to include a hidden input:
<input type="hidden" name="csrf_token" value="{csrf_token}">
You can just grab your form input. You should probably sanitize these inputs.
$year = ee()->input->post('year');
if ( ! preg_match('/^\d{4}$/', $year)) {
show_error('Invalid year');
}
$router->redirect('search/'.$year);
Thank you, @rsanchez !
I gonna try it!
P.S.: Maybe it's an interesting use case for the samples.
P.S.2: Isn't better to use $year = ee()->input->post('year', TRUE);
?
Thank you!
Re: PS2
XSS clean is not really necessary, since I'm ensuring it's a 4 digit number and nothing else using preg_match.
Wow! I gonna close this! I'm sorry!
And thank you!
Hi!
Is it possible to use variables from a submitted form on a redirect? I'm thinking on something like:
Thank you!