Variable Value into MySQL DB

From: Diogo Senai (diogo.senai_at_sistemafieg.org.br)
Date: 12/27/04


Date: Mon, 27 Dec 2004 16:08:20 -0200 (BRST)
To: beginners@perl.org

Hi guys,

I´m having kind´a problem... Here´s the deal... I´m using CGI so that the
user can, by a browser, type the data that must be recorded into the
database.
I use CGI library to do that... the user type what he wants in the fields,
and these values are sent to some variables... Then, I´d like to record
these variables values in the db... But I just can´t get it done!
I´m using Net::MySQL to do so... when I test the script by writing fixed
values in it, it works fine... but when i try to record variables values
it doesn´t work... could you help me? Here´s my code:
#!/usr/bin/perl
use strict;
use CGI qw/:standard/;
 use Net::MySQL;
print header,
        start_html('Cadastro de Processos'),
        h1('Cadastramento Processos'),
        start_form,
        "Numero do Processo: ",textfield('process'),br,
        "Tipo do Processo: [1-2]",textfield('type'),br,
        "Nome do advogado: ",textfield('name'),br,
        "Email do advogado: ",textfield('email'),br,
        submit,
        end_form,
        hr,
my $process =param(process);
my $lawyer =param(name);
my $email =param(email);
my $type =param(type);

  my $mysql = Net::MySQL->new(
      database => 'tj',
      user => 'user',
      password => 'pass'
  );

   $mysql->query(q{
       INSERT INTO processo (process, name, email, type) VALUES ($process,
$lawyer, $email, $type)
   });



Relevant Pages

  • Re: system call
    ... I am using a cgi to call a pl script and then pass xml back to ... the web browser. ... as $pid will contain only decimal digits. ...
    (comp.lang.perl.misc)
  • CGI and Methods??
    ... I'm trying my hand at scripting cgi in ruby. ... looking at Rails. ... Below is a script I'm working on to provide a web interface to our ... This way we don't cause the browser to time ...
    (comp.lang.ruby)
  • CGI and Methods??
    ... I'm trying my hand at scripting cgi in ruby. ... looking at Rails. ... Below is a script I'm working on to provide a web interface to our ... This way we don't cause the browser to time ...
    (comp.lang.ruby)
  • Re: Problem with perl, cgi & pdf
    ... This is the asp.net framework newsgroup and has nothing to do with perl or cgi. ... perl & cgi script to display a pdf document. ... I see nothing in the browser. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Form / CGI error
    ... > html form to a CGI ... > Let's focus on the script, not the HTML. ... >> use strict; ...
    (perl.beginners)