Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 14th, 2001, 10:50 PM
midget2000x midget2000x is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 17 midget2000x User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 16 m 45 sec
Reputation Power: 0
grabbing posted variables - putting in MySQL

Another newbie here (excuse me if my terminology is off) -

I am trying to write a simple form input-to-mysql CGI script and I'm stuck at how to access the variables posted to my perl CGI. All the information I can find accesses the posted variables via the QUERY_STRING environment variable, then splits them into name/value pairs, rather than accessing them directly by name as PHP does.

Basically, I need to get to the point where the variables are named so I can insert them into the SQL statement below.

Can anyone explain to me how to do this, or point me to a resource that can explain it? Thanks!

$sql = "INSERT INTO contact (prefix,firstname,middlename,lastname,address1,address2,city,state,zip,country,email) VALUES ('$prefix','$firstname','$middlename','$lastname','$address1','$address2','$city','$state','$zip','$ country','$email')";

Reply With Quote
  #2  
Old June 15th, 2001, 02:22 PM
Pressly Pressly is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 48 Pressly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Lightbulb Use CGI

Use the CGI module to extract the values from the input field names:

[code]
use CGI ('param');

my $prefix = param('prefix');
my $firstname = param('firstname');
....
my $email = param('email');
[\code]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > grabbing posted variables - putting in MySQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT