Please help me with how to use client inputs in a form as part of arguments in a CGI script following a button return. I want a client to specify a name which i can then use in perl script to create a folder for that client.

Try using the CGI module. It makes doing CGI development in Perl extremely easy (at least the CGI bits).

Try this at a command line:

perldoc CGI

A simple example... (note: more validation should be done, this is just an example...)

// a basic html form

<form action='script.pl' method='post'>
NAME: <input type='text' name='name' size'8' maxlength='8' />
<br />
<input type='submit' name='button' value='Folder Name' />
</form>

// the perl script (script.pl)

#! /usr/lib/perl

use CGI;
use strict;

my $obj = new CGI;

my $name = $obj->param ( 'name' );

my $base = './docs/folders/';

print "Content-type: text/html\n\n"; 

if ( $name eq '' )
{
	print "the directory name was not entered!\n";
}
elsif ( $name !~ m/^[a-z0-9]{1,8}$/i )
{
	print "the directory name was not valid!\n";	
}
else
{
	if ( -e $base . $name )
	{
		print "can not create directory, directory already exists!\n";
	}
	elsif ( ! mkdir ( $base . $name, 0777 ) )
	{
		print "can not create directory\n";
	}
	else
	{
		print "new directory created\n";
	}
}

exit(0);

me!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.