Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending multiple updates and putting them into a database

Status
Not open for further replies.

Fayeby

Programmer
Sep 16, 2002
7
CH
:( [ponytails2]
I am really stuck. I am trying to post through a number of values (updates) into a database. I have them numbered in oder to pass them through to the next page using $loop.

See:

$FORM_TEXT .= &quot;<FORM NAME=\&quot;ModifyAttributes\&quot; \n&quot;;
$FORM_TEXT .= &quot; ACTION=\&quot;/cgi-bin/maintain_environment_attribute.cgi\&quot; \n&quot;;
$FORM_TEXT .= &quot; onSubmit=\&quot;return confirmSubmit('Are you sure ?')\&quot;>\n&quot;;

$FORM_TEXT .= &quot;<INPUT TYPE=\&quot;HIDDEN\&quot; NAME=\&quot;EnvironmentName\&quot; VALUE=\&quot;$EnvironmentName\&quot;>\n&quot;;
$FORM_TEXT .= &quot;<INPUT TYPE=\&quot;HIDDEN\&quot; NAME=\&quot;AttributeGroup\&quot; VALUE=\&quot;$AttributeGroup\&quot;>\n&quot;;

$FORM_TEXT .= &quot;<table border=\&quot;10\&quot; height=\&quot;34\&quot;>\n&quot;;

$FORM_TEXT .= &quot;<TR>\n&quot;;
$FORM_TEXT .= &quot;<TH ALIGN=\&quot;CENTRE\&quot;>Attribute Key</TH>\n&quot;;
$FORM_TEXT .= &quot;<TH ALIGN=\&quot;CENTRE\&quot;>Attribute Value</TH>\n&quot;;
$FORM_TEXT .= &quot;</TR>\n&quot;;

$loop = 1;

while (@COLUMNS = $DBAttributes -> fetchrow ())
{
($Key, $Value )= @COLUMNS;

$FORM_TEXT .= &quot;<INPUT TYPE=\&quot;HIDDEN\&quot; NAME=\&quot;Key$loop\&quot; VALUE=\&quot;$Key\&quot;>&quot;;

$FORM_TEXT .= &quot;<td width=\&quot;20%\&quot;height=\&quot;25\&quot;>$Key</td>\n&quot;;
$FORM_TEXT .= &quot;<td width=\&quot;50%\&quot;height=\&quot;25\&quot;><input type=\&quot;text\&quot; name=\&quot;Value$loop\&quot; size=\&quot;30\&quot; value=\&quot;$Value\&quot;></td>\n&quot;;
$FORM_TEXT .= &quot;</TR>\n&quot;;

$loop++;
}

$FORM_TEXT .= &quot;</table>\n&quot;;

$FORM_TEXT .= &quot;<table>\n&quot;;

$FORM_TEXT .= &quot;<td width=\&quot;15%\&quot;height=\&quot;25\&quot;><input type=\&quot;submit\&quot; size=\&quot;50\&quot; value=\&quot; Modify \&quot; name=\&quot;Modify\&quot;></td>\n&quot;;
$FORM_TEXT .= &quot;<td width=\&quot;15%\&quot;height=\&quot;25\&quot;><input type=\&quot;submit\&quot; size=\&quot;50\&quot; value=\&quot;Clear\&quot; name=\&quot;Clear\&quot;></td>\n&quot;;

$FORM_TEXT .= &quot;</table>\n&quot;;

$loop--;

$FORM_TEXT .= &quot;<INPUT TYPE=\&quot;HIDDEN\&quot; NAME=\&quot;numberattr\&quot; VALUE=\&quot;$loop\&quot;>\n&quot;;


$FORM_TEXT .= &quot;</FORM>\n&quot;;


BUT i doo not know how to get the database to pass it in as it will not recognise value$loop
ANY IDEAS?

Faye
 
An odd way of doing it but if it works! Anyway, first, take the $ out of value$loop. Could be causing confusion. Second, there may be a problem in the way you're getting your hash values. To test, create a test CGI routine that renders a web page and will show the value of your hash variables. This will show exactly what is being passed to your CGI script. There's always a better way...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top