MySQL Forums
Forum List  »  Perl

profile updation problem by perl
Posted by: arupratan biswas
Date: May 07, 2005 12:04AM

my program is on actually user name and password validation of the logged in user.
right now i hav complete the first part means after login i can see the user's profile but still now i cantt unable to update the user's profile.already i write a code in perl just look like following:
#!/usr/bin/perl -w

use = CGI;
use CGI::Carp qw(fatasToBrowser warnongsToBrowser);
use = DBI;

my $ query= new CGI;
print $query->header();
warningsToBrowser(1);
print $query->start_html(-title=> 'Update Profile');

$toname=$ENV{QUERY_STRING};
$toname= ~ tr/+/ /;
$toname=~ s /%(..)/chr hex $1/eg;

print $"toname";

if((query->request_method eq 'POST') &&(query->param("emp_name") ne '') && (query->param("emp_code") ne '') && (query->param("dob") ne '') && (query->param("gender") ne ''))
{
$ename=$query->param("emp_name");
$ecode=$query->param("emp_code");
$d=$query-.param("dob");
$g=$query->param("gender");

$dbh=DBI->connect("DBI:mysql:adminitrative:192.168.0.142:""root",undef) or die "Don't connect to Database:DBI::errstr\n";
$sth=$dbh->prepare("Update new_user SET emp_name='$ename',emp_code='$ecode',dob='$d',gender='$g' where emp_name=?");
$sth=execute($toname);

}

print"<HTML>";
print"<BODY>";
print"<FORM METHOD='POST' ACTION='u_profile.pl'>";
print"<p>Employee Name: </p>";
print"<p> input type='text' name='emp_name' value= '$ename'</p><br>";
print"<p>Employee Code: </p><br>";
print"<p> input type='text' name='emp_code' value='$ecode'</p><br>";
print"<p>Date Of Birth: </p>";
print"<p> input type=''text' name='dob' value='$d'</p><br>";
print"<p>gender Of Employee: </p>";
print"<p> input type ='text' name='gender' value='$g'</p><br>";
print"<p> input type ='submit' value='update'</p>";
print"</FORM>";
print"</BODY>";
print"</HTML>";
print $qyery->end_html();

but it do not work.when i run in linux then display syntex error in line 3 , means use=CGI
AND WHEN I RUN IN WEB BROWSER THEN IT GIVE "Premature end of script headers: u_profile.pl"
PLZ HELP ME,
THANKS

Options: ReplyQuote


Subject
Written By
Posted
profile updation problem by perl
May 07, 2005 12:04AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.