I am putting together a simple website and would like visitors to be
able to type a number into a form (say 1234) and a perl script should
run open an existing page called .../1234.html or generate an error
page if the use enters a wrong number. I will have already uploaded
the page before a user enters the number so the per script can open it
rather than generate a new one (unless it can be generated on the fly
which may be better?)
I think this should be able to be done but I have no idea how. for
instance how do i append the '.html' to the file name.
The website is here (www.ashcraftframing.co.uk) . The fom is in the
bottom right of the page and launches a invopice page for PayPal. I
want users to enter a invoice number corresponding to a page I have
already up loaded.
If anyone know of some pre existing code I can modify I'd be very
grateful. I have only done a little 'cook book' scripting so please
go easy on me!
Thanks
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/
Re: Open existing HTML page from perl script
am 05.05.2011 11:38:11 von Jeff Pang
2011/5/5 Geospectrum :
> Hi,
>
> I am putting together a simple website and would like visitors to be
> able to type a number into a form (say 1234) and a perl script should
> run open an existing page called .../1234.html  or generate an error
> page if the use enters a wrong number. Â I will have already uploaded
> the page before a user enters the number so the per script can open it
> rather than generate a  new one (unless it can be generated on the f=
ly
> which may be better?)
>
That's easy by returnning a redirection.
For example,
use CGI;
my $q =3D CGI->new;
my $page =3D $q->param("page_number");
print $q->redirect("/$page.html");
--=20
Jeff Pang
www.DNSbed.com
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/
Re: Open existing HTML page from perl script
am 05.05.2011 12:25:14 von Rob Dixon
On 05/05/2011 08:31, Geospectrum wrote:
>
> I am putting together a simple website and would like visitors to be
> able to type a number into a form (say 1234) and a perl script should
> run open an existing page called .../1234.html or generate an error
> page if the use enters a wrong number. I will have already uploaded
> the page before a user enters the number so the per script can open it
> rather than generate a new one (unless it can be generated on the fly
> which may be better?)
>
> I think this should be able to be done but I have no idea how. for
> instance how do i append the '.html' to the file name.
>
> The website is here (www.ashcraftframing.co.uk) . The fom is in the
> bottom right of the page and launches a invopice page for PayPal. I
> want users to enter a invoice number corresponding to a page I have
> already up loaded.
>
> If anyone know of some pre existing code I can modify I'd be very
> grateful. I have only done a little 'cook book' scripting so please
> go easy on me!
An onClick attribute to your button will do the trick. Just something
like this
will do what you describe, but you will need to write more to validate
the input before trying to display the invoice.
It is probably also possible to generate the invoice on the fly. How
difficult that might be depends on the format you want to see.
HTH,
Rob
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/