ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would like to create a randomly generated table by the user, the user will have the option to put x amount of cols and x mount of rows. once the user puts that in and submits it, i want the perl script to output that table with x cols and x rows
wow, thanks for the lengthy description of your situation. with all that info im sure you will get plenty of accurate answers.
maybe try to list what you have so far, for starters do you have a server with perl enabled? do you even know perl? do you know how to make forms in html? etc, etc, etc
yes, i know perl more or less, and yes i know how to make tables in html, and yes i have a server with perl enabled and its already running some scripts:
iam just looking for a general snippit of code to work with? more or less
yes, i know perl more or less, and yes i know how to make tables in html, and yes i have a server with perl enabled and its already running some scripts:
iam just looking for a general snippit of code to work with? more or less
Eg:
Code:
HTML SIDE | PERL SIDE OUTPUT TO BROWSER
--------- | ---------------------------
|
Please enter # of rows [2] | ___ ___
Please enter # of cols [2] | | | |
| |---|---|
Submit | |___|___|
yes, i know perl more or less, and yes i know how to make tables in html, and yes i have a server with perl enabled and its already running some scripts:
iam just looking for a general snippit of code to work with? more or less
well its going to be more than a "snippit" of code. if you know perl and html and also have the server setup, i dont see what the problem is..
maybe someone else will want to write the program for you, but i dont.
(not trying to be a smartass (well maybe a little), but have you even attempted it?)
Yes i have, iam sorry i didnt paste it earlier. when i run it, it bascially goes into a loop and makes a trillion cols with 1 row.
but here it is:
Code:
#!/usr/bin/perl
use warnings;
use CGI;
my $cgi = new CGI;
# |------------------------------------------|
# | Here iam bringing over the paramaters |
# | from the user input. Eg: col=5 ,row=5 |
# |------------------------------------------|
my $col = $cgi->param('col');
my $row = $cgi->param('row');
print "Content-type\:text/html\n\n";
print "<html>";
print "<body>";
# |------------------------------------------|
# | Here i want to make a dynamic table from |
# | the user input x col, and x row |
# |------------------------------------------|
print "<table border=1>";
while($row!=0){
print "<tr>";
while($col!=0) {
print "<td>";
print "testdata";
print "</td>";
$col--;
}
print "</tr>";
$row--;
}
print "</table>";
print "</body>";
print "</html>";
Do you know how make a formated webpage with your cgi script?
i am trying but keep getting server errors. I do not know any of the syntax, I am tryig to use other peoples code for a starters but I do not know where to begin.
I have a webpage that I want to calculate something with my script and create a formated webpage and print info on that page.
(sorry i forgot about you until circuit_girl posted..)
one problem is that you need to use some sort of temp variable in the loops, when you decrement col for the first row, none of the other rows will have any cols.
i dont see why it would be printing out a ton of columns though.. try a print when you get the cgi data, and make sure the col and row are what you think they are..
Do you know how make a formated webpage with your cgi script?
i am trying but keep getting server errors. I do not know any of the syntax, I am tryig to use other peoples code for a starters but I do not know where to begin.
I have a webpage that I want to calculate something with my script and create a formated webpage and print info on that page.
I am unable to even get the page to show up.
circuit_girl, it would probably be appropriate to start a new thread for your question. it would definately get more attention that way, your question might get lost in this thread..
also when you start that other thread, post the errors you get when you try the page. if you dont see any obvious errors, check the error log for your server.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.