Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Open Source > Perl
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Perl section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 2nd, 2006, 10:06 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default get the values of form field values

use CGI; $cgi = new CGI; if(!defined $newform->validate) { $submitted = $newform->submitted([ qw(title description type email interest dateposted)]); # set form field variable values in HERE }



is it possible to get the values of form field values that have been posted to this page?

how is it done?

Picco

www.crmpicco.co.uk
www.ie7.com
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
Reply With Quote
  #2 (permalink)  
Old November 3rd, 2006, 05:32 AM
Friend of Wrox
Points: 1,515, Level: 15
Points: 1,515, Level: 15 Points: 1,515, Level: 15 Points: 1,515, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Oxford, , United Kingdom.
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey crmpicco

You can just do (example to get the title field):

<code>
my $title = $cgi->param('title');
</code>

--
Don't Stand on your head - you'll get footprints in your hair
                                           http://charlieharvey.org.uk
                                              http://charlieharvey.com
Reply With Quote
  #3 (permalink)  
Old March 16th, 2007, 10:57 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

hi, that worked a treat by the way charlie....forgot to write back....
here's my working script!!
Code:
#! /usr/bin/perl

# Craig R Morton
# Last_Edit: 08-Nov-2006

use CGI;
use ready::Sql;

$cgi = new CGI;
$sql = new ready::Sql;

$header = << 'STOP';
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Edit Contact</title>
<link rel="stylesheet" type="text/css" href="/ssi/extranet.css">
<script src="/ssi/extranet.js" language="javascript"></script>
<script language="javascript">
<!--
function redirecttostart()
{
    window.location="craigtest.pl";
}
//-->
</script>
<script src="crmjs.js" language="javascript"></script>
<style type="text/css">
<!--
body {
    background-color: #ECECEC;
}
.table_contacts {
    width: 100%
    border: 2px;
    border-color: #000000;
    border-style: solid;
    font-family: Verdana;
    font-size: 11px;
}
-->
</style>
</head>
<body >
STOP

$footer = << 'STOP';
</body>
</html>
STOP

# Form field values passed from the previous page
$contactid = $cgi->param('hcontactid');
$name = $cgi->param('name');
$birthdate = $cgi->param('birthdate');
$email = $cgi->param('email');
$interest = $cgi->param('interest');
$telno = $cgi->param('telno');
$admin = $cgi->param('admin');

# if the admin 'yes' button has been checked then insert '1' into the DB otherwise insert '0'
if ($admin eq "yes") {
    $adminval = "1";
}
else {
    $adminval = "0";
}

# Update the DB with the values (name, birthdate, etc......) passed from the previous page
$sql->query(q{UPDATE `craigrm`.`contacts` SET name = (?), birthdate = (?), email = (?), interest = (?), telno = (?), admin = (?) WHERE contact_id = (?)}, $name, $birthdate, $email, $interest, $telno, $adminval, $contactid);

@getrecords = $sql->query(q{SELECT contact_id, name, birthdate, email, interest, telno, admin FROM `craigrm`.`contacts` ORDER BY contact_id ASC});

$content = "<table class='table_contacts' align='center'><tr><td>Contact ID</td><td>Name</td><td>Birthdate</td><td>Email</td><td>Interest</td><td>Tel No.</td><td>Admin</td></tr>";

while ($result = $getrecords[0]->fetchrow_hashref) {
    $dbcontactid = $result->{"contact_id"};
    $dbname = $result->{"name"};
    $dbbirthdate = $result->{"birthdate"};
    $dbemail = $result->{"email"};
    $dbinterest = $result->{"interest"};
    $dbtelno = $result->{"telno"};
    $dbadmin = $result->{"admin"};

    $content .= "<tr><td>$dbcontactid</td><td>$dbname</td><td>$dbbirthdate</td><td>$dbemail</td><td>$dbinterest</td><td>$dbtelno</td><td>$dbadmin</td></tr>";
}

$content .= "</table>";

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

print "<div align='center'>";
    require "banner.pl";
    print "<br>Database Updated....";
print "</div>";

print $content;

=pod
print "Contact ID = $contactid<br>";
print "Name = $name<br>";
print "Birthdate = $birthdate<br>";
print "Email = $email<br>";
print "Interest = $interest<br>";
print "Tel No. = $telno<br>";
print "Admin = $admin<br>";
print "Adminval = $adminval<br>";
=cut

print "<div align='center'>";
    print "Back to Start";
print "</div>";
print $footer;
www.crmpicco.co.uk
www.ie7.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to concatenate two values into one field haixia XSLT 3 November 7th, 2016 02:33 PM
Default Field Values tachtenberg Reporting Services 1 February 19th, 2008 05:52 PM
Multiple Values In One Field lefty4080 Access 1 December 12th, 2007 08:59 AM
Selecting on different values of the same field alphahamster SQL Language 4 May 30th, 2006 11:08 AM
Adding multiple form field values to database cdenequolo Classic ASP Basics 1 August 17th, 2004 05:38 PM



All times are GMT -4. The time now is 11:29 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.