PDA

View Full Version : How to change value of submit button onclick in perlcgi


shorye
05-15-2008, 11:16 PM
Is there any way to change the value of sub,it button on click in perlCGI ??

please suggest


print "<input type=\"submit\" name=\"del\" value=\"DEL\"></td></tr>\n";

I want to replace "DEL" with one of my values is coming from Data base.

oesxyl
05-15-2008, 11:52 PM
Is there any way to change the value of sub,it button on click in perlCGI ??

please suggest


print "<input type=\"submit\" name=\"del\" value=\"DEL\"></td></tr>\n";

I want to replace "DEL" with one of my values is coming from Data base.

why don't use cgi module? The way you doing now just write text to stdout:

print "<input type=\"submit\" name=\"del\" value=\"".$dbdelvalue."\"></td></tr>\n";

don't miss/typo dots and quote, :).

what about using [ code] and [ /code] tags? :)

regards

FishMonger
05-16-2008, 12:52 AM
Let's fix the "leaning tower of Pisa syndrom".
print qq(<input type="submit" name="del" value=".$dbdelvalue."></td></tr>\n);

oesxyl
05-16-2008, 01:04 AM
Let's fix the "leaning tower of Pisa syndrom".
print qq(<input type="submit" name="del" value=".$dbdelvalue."></td></tr>\n);

agree, is more clean and easy to read, but in that case I suggest, shorye, to read perlop documentation for generalized quotes. :)

regards

KevinADC
05-16-2008, 08:32 AM
Let's fix the "leaning tower of Pisa syndrom".
print qq(<input type="submit" name="del" value=".$dbdelvalue."></td></tr>\n);

You don't need the concatenation operator anymore:

print qq(<input type="submit" name="del" value="$dbdelvalue"></td></tr>\n);

shorye
05-16-2008, 02:43 PM
ohh, I am sorry, did not explain you properly..........


print qq(<input type="submit" name="del" value="DEL"></td></tr>\n);

I want to replace "DEL" with one of my values is coming from Data base but I want show the "DEL" only the button name.

-Or- in simple term I want to change change the button's VALUE "on click" to my data base value $@row[0]


Please suggest, thanks

bazz
05-16-2008, 07:49 PM
do you mean that you want to show the wrod 'DEL' in the button but send a different value to the next script?

try

print qq(<input type="submit" name="del" action="$dbdelvalue" Value="DEL"></td></tr>\n);


Then, in your next script, you could:


use strict;
use CGI;
my $cgi= new CGI;
my $value = $cgi->param('action');



hth

bazz

shorye
05-17-2008, 01:52 PM
No it does not work :(

Any other way :(

bazz
05-17-2008, 02:46 PM
Sorry I got things mixed up.

try this:



print qq(
<input type="hidden" name="action" value="$dbdelvalue" />
<input type="submit" name="del" value="DEL"></td></tr>
);


Then, in your next script:


use strict;
use CGI;
my $cgi= new CGI;
my $value = $cgi->param('action');



bazz

shorye
05-19-2008, 01:47 AM
I had done the same, thanks for the clue.