SunQuest
           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:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old October 5th, 2000, 08:16 AM
chrisdice4 chrisdice4 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Cape Town, WP, South Africa
Posts: 39 chrisdice4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
I am having a similar problem with the for loop, but I think my logic may be flawed.

I a previous form I have created a table in a while loop from a data base, next to the data retrieved I have included text boxes.

here is a slice of the code (while (@row=$sth->fetchrow) {
$custid = $row[0];
print " <tr>
<td><font size = '5'>$row[1]</font></td>
<td><input type = 'text' size = '4'
name = '$custid&&amount'></td>
<td><select name = '$custid&&size'>
<option> 20
<option> 40
</select></td>
<td><select name = '$custid&&type'>
<option> gp
<option> si
<option> fr
<option> ot
<option> re
<option> hr
<option> tk
</select>
</td>
</tr>";
}

on submission of the form I want to write the info to data base so I named the select and text boxes $custid&&(item_name)
where $custid = a unique customer id in my data base.

My cgi that is simply trying to catch the data is
#cerlbinperl.exe;

use CGI;


$q = new CGI;
print $q->header;
print "<html>
<head>
</head>
<body>";
$check = $q->param('2&&size');

for ($s=1; $s<10;$s++)

{ $siz = $q->param('$s&&size');
print"<br>$siz";

}


print "<br>$check</body></html>";


this does not work $check however picks up one entry.

any ideas, suggestions will be most welcome

Reply With Quote
  #2  
Old October 6th, 2000, 08:01 AM
JSchoof JSchoof is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 82 JSchoof User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 23 m 46 sec
Reputation Power: 8

Well, it's not going to interpolate your variable values because of the single quotes:

$siz = $q->param('$s&&size');

So try some double quotes.

Good luck.

Josh

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > loop problems


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 2 hosted by Hostway