Подскажите пожалуйста, где в коде ошибка. При нажатии на кнопку ничего не происходит, Спасибо Код (Javascript): <td colspan="4" align="center"> <input type="button" value="UPDATE" onClick="document.getElementById('F2').formaction.value='edit'; document.getElementById('F2').formobject.value='$id_a'; document.getElementById('F2').submit();" /> Внизу контекст. Операторы PHP я убрал для ясности HTML: <form id="F2" action="<?=$_SERVER["PHP_SELF"]?>" method="POST" > <table border="3" cellpadding="3" cellspacing="1" bgcolor="#FFCC66"> <!--width="600px"--> <tr><td> <?=$bname?></td></tr> <tr bgcolor="#00CC99"> <th>ID_BAND </th> <th>NAME </th> <th>YEAR </th> <th>MUSIC_KIND</th> <th>MUSIC_KIND2</th> <th>Rating </th> <th>Rating_ART </th> <th>Concept </th> <th>COMMENT </th> </tr> <tr> <td><input type="text" required="required" name="data[id_band]" value="<?=$al['id_band']?>"></td> <td><input type="text" required="required" name="data[name]" value="<?=$al['name']?>"></td> <td><input type="text" required="required" name="data[year]" value="<?=$al['year']?>"></td> <td><input type="text" required="required" name="data[music_kind]" value= "<?=$al['music_kind']?>"></td> <td><input type="text" name="data[music_kind_2]" value= "<?=$al['music_kind_2']?>"></td> <td><input type="number" required="required" type="number" max="10" min="1" name="data[main_rating]" value="<?=$al['main_rating']?>"></td> <td><input type="number" required="required" type="number" max="10" min="1" name="data[rating_art]" value="<?=$al['rating_art']?>"></td> <td><input type="text" name="data[concept]" value= "<?=$al['concept']?>"></td> <td><textarea name="data[comment]" placeholder="<?=$al['comment']?>"></textarea></td> </tr> <tr > <td colspan="4" align="center"> <input type="submit" class="span_b" name="del" value="DELETE" /> <!--<input type="button" value="DELETE" onClick="if (confirm('Really Delete ?')) document.form2.formaction.value='del'; document.form2.formobject.value='<?=$al['id']?>'; document.form2.submit();" />--> </td> <td colspan="4" align="center"> <input type="button" value="UPDATE" onClick="document.getElementById('F2').formaction.value='edit'; document.getElementById('F2').formobject.value='$id_a'; document.getElementById('F2').submit();" /> <!--<input type="submit" class="span_b" name = "edit" value="UPDATE" /> <input type="hidden" name="formobject" value="<?=$al['id']?>" />--> </td> </tr> </table> </form> <br /><br /> --- Добавлено --- А вот это стоит в браузере после корректировки formobject.value='<?=$id_a'?> То есть так правильно, появилось конкретное значение в браузере - 337. Но все равно при клике ничего не происходит. HTML: <input type="button" value="UPDATE" onClick="document.getElementById('F2').formaction.value='edit'; document.getElementById('F2').formobject.value='337'; document.getElementById('F2').submit();" />
Спасибо за ответ. P.S. А что, даже для небольшого сайта надо с твоей т. зрения жестко MVC применять? И вот так нельзя?: PHP: function table_album_update($rs,$bname ) { $formaction = ''; echo "<br_/>";## echo_r($rs); ?> <form id="F2" action="<?=$_SERVER["PHP_SELF"]?>" method="POST" > <table border="3" cellpadding="3" cellspacing="1" bgcolor="#FFCC66"> <!--width="600px"--> <tr><td> <?=$bname?></td></tr> <tr bgcolor="#00CC99"> <th>ID_BAND </th> <th>NAME </th> <th>YEAR </th> <th>MUSIC_KIND</th> <th>MUSIC_KIND2</th> <th>Rating </th> <th>Rating_ART </th> <th>Concept </th> <th>COMMENT </th> </tr> <?php ## $id_a = $rs['id']; echo "ID_".$rs['id']."ID_END"; foreach ($rs as $al) { $id_a = $al['id'] ?> <tr> <td><input type="text" required="required" name="data[id_band]" value="<?=$al['id_band']?>"></td> <td><input type="text" required="required" name="data[name]" value="<?=$al['name']?>"></td> <td><input type="text" required="required" name="data[year]" value="<?=$al['year']?>"></td> <td><input type="text" required="required" name="data[music_kind]" value= "<?=$al['music_kind']?>"></td> <td><input type="text" name="data[music_kind_2]" value= "<?=$al['music_kind_2']?>"></td> <td><input type="number" required="required" type="number" max="10" min="1" name="data[main_rating]" value="<?=$al['main_rating']?>"></td> <td><input type="number" required="required" type="number" max="10" min="1" name="data[rating_art]" value="<?=$al['rating_art']?>"></td> <td><input type="text" name="data[concept]" value= "<?=$al['concept']?>"></td> <td><textarea name="data[comment]" placeholder="<?=$al['comment']?>"></textarea></td> </tr> <tr > <td colspan="4" align="center"> <input type="submit" class="span_b" name="del" value="DELETE" /> <!--<input type="button" value="DELETE" onClick="if (confirm('Really Delete ?')) document.form2.formaction.value='del'; document.form2.formobject.value='<?=$al['id']?>'; document.form2.submit();" />--> </td> <td colspan="4" align="center"> <input type="button" value="UPDATE" onClick="document.getElementById('F2').formaction.value='edit'; document.getElementById('F2').formobject.value='<?=$al['id']?>'; document.getElementById('F2').submit();" /> <!--<input type="submit" class="span_b" name = "edit" value="UPDATE" /> <input type="hidden" name="formobject" value="<?=$al['id']?>" />--> </td> </tr> <?php } ##endforeach ?> </table> </form> <br /><br /> <?php } ################################################################## ################## END OF FUNCTIONS: table_album_update($result) ###### ###########################################################