|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 #c erlbinperl.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 |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > loop problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|