Open the terminal window, you will get terminal prompt. Enter into the
super user with the following username and password. You will get root
prompt.
Username: su
Password:root123
Change into mysql with the following command
>mysql
>create database web;
>show databases;
>use web;
>create table age_info(nam varchar(40), age int(11));
>desc age_info;
Open another terminal window
>chmod 777 /var/www/cgi-bin
>chmod 777 /var/www/html
lab1.html
<html>
<body>
<center><br/><br/>
<table width="50%" border="2"><tr>
<form action="http://localhost/cgi-bin/p1.pl" method="post">
<tr><th> ENTER AGE INFORMATION </th></tr>
<h3>
<td align="center"><br/>Enter your name :<input type="text"
name="nam"><br><br/>
Enter your age :<input type="text" name="age"><br><br/><br/>
click here to send :<input type="submit" value="Send"><br><br/></td>
</h3>
</form></tr>
</table>
</center>
</body>
</html>
l1.pl
#!/usr/bin/perl
use strict;
use CGI':standard';
use DBI;
print header();
print start_html(-title=>"database",-bgcolor=>"#F0F8FF",-text=>"green");
my $nam=param('nam');
my $age=param('age');
my $db=DBI->connect('DBI:mysql:web','root',"") or die "cannot
connect:".DBI->errstr();
my $query=$db->prepare("insert into age_info values('$nam','$age')");
$query->execute();
my $query=$db->prepare("select * from age_info");
$query->execute();
print "<center>";
print "<table width=20% border=2>";
print "<tr><b>STUDENT AGE INFORMATION</b></tr><br/>";
print "<tr><td align=center width=15%><b>NAME</b></td> <td align=center
width=5%><b>AGE</b></td></tr><BR/>";
while(($nam,$age)=$query->fetchrow())
{
print "<tr><td>$nam</td><td>$age</td></tr>";
}
print "</center>";
$query->finish();
$db->disconnect();
print end_html;
exit(0);
super user with the following username and password. You will get root
prompt.
Username: su
Password:root123
Change into mysql with the following command
>mysql
>create database web;
>show databases;
>use web;
>create table age_info(nam varchar(40), age int(11));
>desc age_info;
Open another terminal window
>chmod 777 /var/www/cgi-bin
>chmod 777 /var/www/html
lab1.html
<html>
<body>
<center><br/><br/>
<table width="50%" border="2"><tr>
<form action="http://localhost/cgi-bin/p1.pl" method="post">
<tr><th> ENTER AGE INFORMATION </th></tr>
<h3>
<td align="center"><br/>Enter your name :<input type="text"
name="nam"><br><br/>
Enter your age :<input type="text" name="age"><br><br/><br/>
click here to send :<input type="submit" value="Send"><br><br/></td>
</h3>
</form></tr>
</table>
</center>
</body>
</html>
l1.pl
#!/usr/bin/perl
use strict;
use CGI':standard';
use DBI;
print header();
print start_html(-title=>"database",-bgcolor=>"#F0F8FF",-text=>"green");
my $nam=param('nam');
my $age=param('age');
my $db=DBI->connect('DBI:mysql:web','root',"") or die "cannot
connect:".DBI->errstr();
my $query=$db->prepare("insert into age_info values('$nam','$age')");
$query->execute();
my $query=$db->prepare("select * from age_info");
$query->execute();
print "<center>";
print "<table width=20% border=2>";
print "<tr><b>STUDENT AGE INFORMATION</b></tr><br/>";
print "<tr><td align=center width=15%><b>NAME</b></td> <td align=center
width=5%><b>AGE</b></td></tr><BR/>";
while(($nam,$age)=$query->fetchrow())
{
print "<tr><td>$nam</td><td>$age</td></tr>";
}
print "</center>";
$query->finish();
$db->disconnect();
print end_html;
exit(0);
Error is showing
ReplyDeleteCouldn't create child process 720002
ReplyDeleteChmod is no supported by windows cmd....how to give permission
ReplyDeleteHow can i give permission on cmd and also I use xampp
ReplyDelete