Jump to content

forms within loops


mc136

Recommended Posts

Hi I have the following piece of code which enters all data into a table and if all data entered will show green image or blue (and text box) if not. My problem is with creating a form basically don't know where to start. Ive tried but will only update the last text box. Any help please!! ???

 

while($Array = mysql_fetch_array($result, MYSQL_ASSOC)){

$arr[] = $Array;

}

 

echo "<pre style=\"text-align: left; font-size: 10px;\">";

  print_r( $arr );

echo "</pre>";

 

foreach($arr as $key => $value){

echo "<tr><td><H1>" . $value['qName'] . "</td>";

 

foreach($value as $chk => $num){

if(preg_match("/^chk/",$chk) && $num >= "0"){

echo "<td><p>" . $num . "</td>";

}elseif(preg_match("/^chk/",$chk) && $num == ""){

echo "<td><input type='text' name='check1' size='1'></td>";

}

}

 

//----------test-works---------

 

if($value[chk1] == ""){

print "<td align='center'><img src=\"blue.jpg\" width=\"15\" height=\"15\" alt=\"description of the photo\"></img></td>";

}elseif($value[chk2] == ""){

print "<td align='center'><img src=\"blue.jpg\" width=\"15\" height=\"15\" alt=\"description of the photo\"></img></td>";

}else{

print "<td align='center'><img src=\"green.jpg\" width=\"15\" height=\"15\" alt=\"description of the photo\"></img></td>";

}

        //----------end test------

}

Link to comment
https://forums.phpfreaks.com/topic/37911-forms-within-loops/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.