Closed DavidLingier closed 5 months ago
Hello, welcome to SQLPage, and thank you for the clear report.
The redirect component must be the very first in a page. You are seeing an error because you have a form component before your redirect component. You have two solutions:
An example solution:
form.sql
select
'form' as component,
'user.sql?id=' || $id as action;
select 'text' as type, 'Username' as name, username as value
from users where id = $id;
user.sql
update users set name=:Username where :Username is not null and and id=$id;
-- Your code that presents an user here
Thanks @lovasoa, with this input I was able to make it work.
Introduction
I've tried to create a redirect on a "update" action, based on a working "delete" example. https://github.com/lovasoa/SQLpage/discussions/194 While testing this, the error message is returning instructions, but when applying these instructions the error remains the same.
To Reproduce
Starting from the "simple-website-example", I've changed the edit.sql file as follows:
Actual behavior
Error returned:
Screenshots
Expected behavior
Why does the redirect work on a "delete" and not on a "update"? How should the redirect be implemented, when placed on top of the .sql file?
Version information