neo Posted January 10, 2005 Report Posted January 10, 2005 $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?
Venom Posted January 10, 2005 Report Posted January 10, 2005 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) ....
Recommended Posts