I have a problem passing the input type="hidden" form with the CGI library of SWI-Prolog. Specifically I do:
<form id="frmCGIPrologIni" name="frmCGIPrologIni" method="post" action="http://localhost/cgi-bin/x.pl"> <p><input type="hidden" name="initial" value="ini" /> <input class="submit" type="submit" value="Start" /> </p></form>
when the program x.pl calls cgi_get_form(Arguments)
Arguments should be a list of Name(Value) terms, i,e: [Name, Value], so it should be [initial(ini)].
but when I use this it says: ERROR: =../2: Arguments are not sufficiently instantiated
print_args([]).
print_args([F|T]) :- % with Arguments
F =.. [Name, Value], % and should continue doing things
I've tried to print it manually with write(Arguments) and what I get is: _L160
, and printing the first element is: _G472
and write_canonical(Arguments) returns: '.'(_,_)
I've tried also using the method="get" just for checking it and it prints the URI correctly http://localhost/cgi-bin/x.pl?initial=ini
so I guess is not a problem of submitting but of handling with cgi_get_form(Arguments).
The first time 'http://localhost/cgi-bin/x.pl' runs I do:
cgi_get_form(Arguments),
(Arguments = []) ->
(
format('<p>Print this as the index.</p>~n', []),
) ; true, % and it works well because there are no Arguments the first time
write('<p>'), write(Arguments), write('</p>'), nl, % and print other things
The problem is the second time. This time calling the same program there are Arguments so it doesn't print the message, up to here everything is fine. Then goes through true and continues. That's when I try to write(Arguments) with the results explained before (_L160
). And the results should be the data passed by the form.
any thoughts on what is the problem?