Jump to content
php.lv forumi

radio pogu grupas


neo

Recommended Posts

$result=mysql_query("SELECT * FROM personas");

 

print "<form name=\"form1\" method=\"post\" action=\"\"> ";

 

while($row = mysql_fetch_array($result)){

 

echo" $row[vards]  $row[uzvards]<p>

 

<input type=\"radio\" name=\"grupa$row[id]\" value=\"1\">Jā <br>

<input type=\"radio\" name=\"grupa$row[id]\" value=\"0\">Nē<br>";

 

{//end while

 

print"<input type=\"submit\" name=\"submit\" value=\"Submit\">

</form>";

 

Kaa dabuut radio grupas veertiibu par katru personu, kad forma tiek izpildiita, ja tabulaa "presonas" ir vairaaki ieraksti?

Link to comment
Share on other sites

pieņemsim, ka personām ir unikāls id

while fetch...

{

echo $rows['Name'].' / ';

echo '<input type="radio" name="result['.$rows['id'].']" value="0" /> Nē';

echo '<input type="radio" name="result['.$rows['id'].']" value="1" /> Jā ';

}

 

foreach($_POST['result'] as $personas_id=>$atbilde)

....

Link to comment
Share on other sites

×
×
  • Create New...