Re: Its working now...!!!
Hi Naveen,
OK, as you asked so nicely ;-)
First of all, whether or not to create functions in the same pl script, or in a separate script ? My tendency would be to create them in a separate script and then include this into your main script. In this way you can use the functions in any other script that you create, and you only have to edit a single file if you want to change the functions in any way. If the functions are very specific to this script, and will never be used elsewhere, then create them in the main script.
Next - the form methods. I would always recommend using the POST method for forms, as it helps with security and doesn't expose the name/value parameters via the URL. So, make the form's method=POST and then create your two buttons. Give each button the same name ('submit') but different values, e.g.
<input type="submit" name="submit" value="View Profile">
<input type="submit" name="submit" value="Update Profile">
then, you can check to see which button was used as follows:
#######################################
# get the form data
@params = $query->param();
#What are we doing?
$action=$query->param("submit");
if ($action eq "View Profile") {
# do view stuff here... ;
} elsif ($action eq "Update Profile") {
# do update stuff here... ;
} else {
# no button clicked - so initialise the page ;
}
rest of code here ;
#######################################
Is this the kind of thing you need ?
Cheers,
Nick
--
Nick Roper