User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Perl section within the Software Development category of DaniWeb, a massive community of 425,795 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,130 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Perl advertiser: Programming Forums
Views: 913 | Replies: 0
Reply
Join Date: Jun 2008
Posts: 11
Reputation: Scruffstone is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Scruffstone Scruffstone is offline Offline
Newbie Poster

Getting input submit button name from another file

  #1  
Jul 2nd, 2008
Hi there,

I'm trying to write a script that when a user clicks the "save" button it takes the content of a text box, calls another script which writes this to a file. The bit I can't get it to do is recognise that the "save" button has been clicked on. I want it to do this as I want to add other buttons at a later stage.

Below is the code that calls the file

 print "<form name=\"page_editor\" METHOD=\"POST\" action=\"/cgi-bin/Process_page_editor_form.pl\">\n\n"; # form action = call a perl file that processes the text, don't do it in this file
display_text_box();
print "\n<br>";
print "<input name=\"input_file_name\" type=\"hidden\" value=\"$INPUT_FILE_NAME\" />";
print "<input name=\"input_filehandle\" type=\"hidden\" value=\"$INPUT_FILEHANDLE\" />";
print "<input name=\"local_text\" type=\"hidden\" value=\"$local_text\" />";

#print "<button type=button onClick=\"button_click(2)\">Save1</button>"; # display a button that runs a sub when clicked
print "<input type=\"submit\" name=\"save\" value=\"Save\">"; # display a button that runs a sub when clicked

And here is the code it's calling. If I print out the value of "input_file_name" it works fine but "name" is blank....

#!/usr/bin/perl

use strict;
use warnings;
use CGI;
use CGI::Carp qw/fatalsToBrowser/;
use Fcntl qw(:flock);

my $query = new CGI;

print "Content-type: text/html\n\n"; # must send a header first

my $button_value = $query->param('name');
my $input_file_name = $query->param("input_file_name");

Any ideas gratefully received.
cheers
Sarah
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Perl Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Perl Forum

All times are GMT -4. The time now is 3:24 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC