•
•
•
•
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
![]() |
•
•
Join Date: Jun 2008
Posts: 11
Reputation:
Rep Power: 1
Solved Threads: 0
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
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....
Any ideas gratefully received.
cheers
Sarah
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
![]() |
•
•
•
•
•
•
•
•
DaniWeb Perl Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Redesign an input type="file" (JavaScript / DHTML / AJAX)
- Storing an Encrypted file in database (ASP.NET)
- how to get 1 submit button to validate user's choice (ASP)
- upload file using jsp and mysql (JSP)
- PHP saving to a file (PHP)
- why won't my print button work (JavaScript / DHTML / AJAX)
- web input (Web Developers' Lounge)
- Can I have a form without having an associated file. (JavaScript / DHTML / AJAX)
- insert csv file into mysql through php (PHP)
- Printing using Web Control Print button VB.NET (JavaScript / DHTML / AJAX)
Other Threads in the Perl Forum
- Previous Thread: Passing a parameter from a form
- Next Thread: launch program with perl and write to it


Linear Mode