Gossamer Forum
Quote Reply
HELP
Hi All,


I am attempting to construct a set of code that must send information to pay pal via a post, and at the same time insert some of those values into a database. The problem I am having is that upon hitting submit; the info is transmitted to papal, cutting off the code that will connect and insert values into the database.

The piece of code below was used only to test my idea – only two variables $email and $name was used only for a test.

Upon hitting submit a pay pal credit card form appeared to receive payment cutting off the if( param(‘yes’) eq “submit” ){ if( param('email') ne "" && param('name') ne "" )

Is it possible to send messages to two scripts via a post simultaneously?
If not – how can I complete the task?

#---------------------------------------------------------------------------------------

#!/usr/bin/perl -w

use strict;
use CGI qw(:standard);
use DBI;
#--------------------------------------------------------------------
sub dispForm;
sub dBase;
#--------------------------------------------------------------------
sub dispForm
{
my( $email,$name );


print start_form( -action => 'https://www.paypal.com/cgi-bin/webscr' );

print hidden( -name =>"cmd", value => "_xclick" );

print hidden( -name => "business", -value => 'driv@lycos.com' );

print hidden( -name => "amount",-value => 0.59 );

print hidden( -name => "item_name", -value => 'Cruise & Hotel Giveaway

payment.' );


print ("Name :");

print textfield( -name => "name",-size => 20 );

print br();

print ("E Mail :");

print textfield( -name=> "email",-size => 20 );

print br();


print submit( -name => "yes",-value => "submit");

if( param(‘yes’) eq “submit” ){

if( param('email') ne "" && param('name') ne "" )
{
my $v = "";

$v .= $name;
$v .= ":";
$v .= $email;
&dBase( $v );
}
}

print end_form();
}
#-----------------------------------------------------------
sub dBase
{
my $value = shift;

my ( $name,$email,$count );

my ( $dbs,$dbc );

( $name,$email ) = split(":",$value );


$dbc = DBI->connect("DBI:mysql:host = localhost;database=bargaint","sdd","mahasina",
{ PrintError => 0, RaiseError => 1 } );

$dbs = $dbc->prepare( "INSERT INTO fourth (name,email) VALUES (?,?)");

$count = 0;
$count = $dbs->execute($name,$email);

$dbs->finish();
$dbc->disconnect();

}
#-----------------------------------------------------------
print header();

print start_html(-title => 'Anderson',-bgcolor => 'green');

&dispForm();

print end_html();

#--------------
Quote Reply
Re: [TheSafePick] HELP In reply to
why don't you submit the info to paypal after a succesful db insert?
If you check the paypal forum, I'm sure you'll find what you are looking for. I seem to remember having seen just that the other day.
Nora @
www.baytides.ca