where to place the statements?
hi nick,
earlier i made a script view_profile.pl which was to show the profile if the button was clicked. but how can i pass the $chkuser parameter to this new script from the main script, based upon which it will create the sql statement to select a profile to show from the db??
Another thing i tried as u said in the above post --- i placed the two buttons and the code to implement them in nested if statements in the main script within the code to check the pwd. So it looked like --
if ($md5password eq $pass)
{
print "<p> You have successfully logged in $chkuser!<p>";
print "<html>;
print "<form method='POST'>";
print "<input type='submit' name='submit' value='View Profile'> <input type='submit' name='submit' value='Update Profile'>";
print "</form>";
print "</html>";
@params = $query->param();
$action=$query->param("submit");
if ($action eq "View Profile")
{
$dbh = DBI->connect("DBI:mysql:database=$db:host=$host", $user, $password) or die "Can't connect to database:$DBI::errstr\n";
$qry = $dbh->prepare("SELECT emp_id, emp_name, permanent_address, dob, permanent_phone FROM new_user where emp_name='$chkuser'");
$qry->execute;
@vrow=$qry->fetchrow_array;
print "Content-type: text/html\n\n";
print "<hr>";
print "<p>Employee ID is : @vrow[0]</p><br>";
print "<p>Employee Name is : @vrow[1]</p><br>";
print "<p>Employee Address is : @vrow[2]</p><br>";
print "<p>Employee's Date of Birth is : @vrow[3]</p><br>";
print "<p>Employee's Phone No. is : @vrow[4]</p><br>";
print "<hr>";
$dbh->disconnect;
print $query->end_html();
}
elsif ($action eq "Update Profile")
{
print "<p>Update</p>";
}
else
{
print "<p> Click a Button!</p>";
}
$dbh->disconnect;
print $query->end_html();
}
But in this case i'm getting lot of errors on command line and in the browser, the progress bar is getting stuck midway, not producing any output.
Wt to do? which way to go and wt code to write
With regards
naveen