Hey there, I want to add a form to my website which takes an input, gets the page with the input as title and then updates its content with the submitted data.
the function looks as follows:
$update = page(get('input'))->update([
...
]);
I also tried to get the page with filterBy. But I always get that error message:
What does get('input') give you? If that’s the title of the page, then you would have to try and find the page by title: $pages->findBy('title', get('input')) and before you call update() you have to check if the page exists.
Make sure to sanitize/validate user input before you pass it to a method, in this example, passing a script to the page() helper probably won’t do any harm, but in other cases it might be really dangerous.