Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Passaggio parametri

11 views
Skip to first unread message

asom�

unread,
May 27, 2013, 8:48:04 AM5/27/13
to
Salve,
� possibile passare un parametro da html (ottenuto attraverso un <input>) a
un programma in Perl che si trova nella cartella cgi-bin, per elaborarlo?
Grazie a tutti


enoquick

unread,
May 27, 2013, 9:08:42 AM5/27/13
to
Il 27/05/2013 07:48, asomè ha scritto:
> Salve,
> è possibile passare un parametro da html (ottenuto attraverso un <input>) a
> un programma in Perl che si trova nella cartella cgi-bin, per elaborarlo?
> Grazie a tutti
>
>


In html occorre definire un form:

<form id="new_form" method="post" action="/cgi-bin/prova.pl">
<fieldset>
<legend>Login de Usuario</legend>
<p><label>id: </label><input name="id" value="" maxlength="4"
type="text"/>
</fieldset>
</form>


in prova.pl:

use CGI;
my $cgi = CGI->new;
my %values=map {
my @v=$cgi->param($_);
my $v=scalar(@v) > 1 ? \@v : $v[0];
($_,$v)
} $cgi->param;


my $id =$values{id};



Dovrebbe essere chiaro

enoquick

unread,
May 27, 2013, 9:42:38 AM5/27/13
to
Dimenticato, nel tag form ovviamente occorre anche il bottone di submit:

<input class="button" id="Submit" name="Submit" value="submit"
type="submit"/>



asomè

unread,
May 28, 2013, 5:22:30 AM5/28/13
to

"enoquick" <enoq...@gmail.com> ha scritto nel messaggio
news:knvnkf$esu$2...@dont-email.me...
Grazie del consiglio.
Vado a provare.


0 new messages