OK, I've gotten the script to add the first 3 fields out of 14. But it will not add the 4th field, or any others. I created a simple HTML page to display the form, here: http://www.labourstart.org/2011/register.html.
The first 3 fields can be added to the database. But not the fourth (union). If you fill in the form, you'll see a screen showing what you've put into the fields. I receive an email with all the data you've input. So I think that's all fine. But the MySQL database won't update beyond the first 3 fields. Here's the structure of the database (from MyPHPadmin):
Field Type Collation Attributes Null Default
+Extra Action
name varchar(128) latin1_german2_ci No
+
country varchar(128) latin1_german2_ci No
+
language varchar(128) latin1_german2_ci No
+
union varchar(128) latin1_german2_ci No
+
title varchar(128) latin1_german2_ci Yes NULL
+
email varchar(128) latin1_german2_ci No
+
cellphone varchar(128) latin1_german2_ci Yes N
+ULL
landlinephone varchar(128) latin1_german2_ci Yes
+ NULL
facebook varchar(128) latin1_german2_ci Yes NU
+LL
skype varchar(128) latin1_german2_ci Yes NULL
+
twitter varchar(128) latin1_german2_ci Yes NUL
+L
gender varchar(16) latin1_german2_ci No
+
age varchar(64) latin1_german2_ci No
+
needshelp varchar(16) latin1_german2_ci No
And here's the entire CGI script:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
use CGI qw(param);
$name = param("pname");
$country = param("pcountry");
$language = param("planguage");
$union = param("punion");
$title = param("ptitle");
$email = param("pemail");
$cellphone = param("pcellphone");
$landlinephone = param("plandlinephone");
$facebook = param("pfacebook");
$skype = param("pskype");
$twitter = param("ptwitter");
$gender = param("pgender");
$age = param("page");
$needshelp = param("pneedshelp");
# 1 Adds record to database of registrants
use DBI;
$db = DBI->connect('******','**********','******');
my $sth = $db->prepare("insert into istanbul2011(name, country, langua
+ge, union, title, email, cellphone, landlinephone, facebook, skype, t
+witter, gender, age, needshelp) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
+;
$sth->execute($name, $country, $language, $union, $title, $email, $cel
+lphone, $landlinephone, $facebook, $skype, $twitter, $gender, $age, $
+needshelp);
$db->disconnect();
# 2 Sends an email confirmation message to us
$to = "ericlee\@labourstart.org";
$from = "ericlee\@labourstart.org";
$content1 = "Name: $name\nCountry: $country\nEmail: $email\nUnion: $un
+ion\nTitle: $title\nLanguage: $language\nCell phone: $cellphone\nLand
+line phone: $landlinephone\nFacebook: $facebook\nSkype: $skype\nTwitt
+er: $twitter\nGender: $gender\nAge: $age\nNeeds help: $needshelp";
open(MAIL, "|/usr/sbin/sendmail -t");
print MAIL "To: $to\nFrom: $email\n";
print MAIL "Subject: $name from $country has registered to attend the
+LabourStart conference\n";
print MAIL "The following application form has been submitted:\n\n$con
+tent1\n";
close (MAIL);
# 3 Sends an email confirmation message to the registrant
$content2 = "Dear $name \n\nThank you for registering to attend the La
+bourStart conference this year.\n\nFor full information about the con
+ference, please make sure to visit http://www.labourstart.org/2011.\n
+\n\We'll be writing to you again closer to the date of the event.\n\n
+Looking forward to seeing you there.\n\nEric Lee\n";
open(MAIL, "|/usr/sbin/sendmail -t");
print MAIL "To: $email \nFrom: $from\n";
print MAIL "Subject: Thank you for registering to attend the LabourSta
+rt conference\n";
print MAIL "$content2\n";
close (MAIL);
# 4 Posts a thank you message on the screen, also showing details subm
+itted
print qq|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Thank you!</title>
</head>
<body>
<h1>The following information has been added to our database of confer
+ence registrants:</h1>
<p>Name: $name</p>
<p>Country: $country</p>
<p>Language: $language</p>
<p>Union: $union</p>
<p>Title: $title</p>
<p>Email: $email</p>
<p>Cellphone: $cellphone</p>
<p>Landlinephone: $landlinephone</p>
<p>Facebook: $facebook</p>
<p>Skype: $skype</p>
<p>Twitter: $twitter</p>
<p>Gender: $gender</p>
<p>Age: $age</p>
<p>Needshelp: $needshelp</p>
<hr />
<h2>You have been sent a confirmation email message.<br /><a href="htt
+p://www.labourstart.org/2011">Click here to return to our conference
+website</a></h2>
</body>
</html>
|;
Any ideas? Help!
|