有两种带有提交按钮的表格。当我单击第一个表单的提交按钮时,但第二个按钮不起作用。为什么?
<?php
$col=['#EFFBFB', '#E0F8F7'];
$ind=0; $link = mysql_connect('127.0.0.1', 'aaa', 'aaa'); if (!$link) {
die('Ошибка соединения: ' . mysql_error()); } mysql_select_db("aaa");
$result = mysql_query("SELECT max(id) FROM zal"); $row = mysql_fetch_array($result);
if ( isset($_POST['submit']) ) { $string=($_POST['amsativ']); $string1=($_POST['qash']); $s1="INSERT INTO `zal` ( `datetime`, `qash`) VALUES ('".$string."','".$string1."');"; $result = mysql_query($s1); header("location:index.php"); exit; }
if ( isset($_POST['Dosh1']) ) {
$string=($_POST['id1']); // echo $string; $string1=($_POST['Dosh teq trenajer1']);
$s1="UPDATE `zal` SET `dteq`='".$string1."' WHERE id=". $string; //echo($s1); $result = mysql_query($s1); header("location:index.php"); exit; }
//echo "<form action='/zal/forinsert.php' method='post'>"; echo "<form action='' method='post' name='form0'>"; echo "<input type='edit' name='id1' value=".$row[0].">"; date_default_timezone_set('Asia/Tbilisi');
$date = date('m.d.Y H:i '); echo $date;
echo "<input id='amsativ' type='hidden' name='amsativ' value='".$date."' size='11'>";
echo "<input id='qash' name='qash' type='edit' value='0' maxlength='5' size='4'>"; echo " <input type='submit' value='New day' name='submit'></form>";
echo "<table border='1' style='border-collapse: collapse; border: 1px solid black;'>"; echo "<tr height='50' bgcolor='#A9E2F3' >"; //echo "<td align='center' width='30'>ID</td>"; echo "<td align='center' width='10'>Amsativ</td>"; echo "<td align='center' width='20'>Qash</td>"; echo "<td align='center' width='20'>Dosh teq trenajer</td>"; echo "<td align='center' width='20'>Dosh teq gantel</td>"; echo "<td align='center' width='20'>Dosh crossover razvodka</td>"; echo "<td align='center' width='20'>Dosh xammer</td>";
$result = mysql_query("SELECT * FROM zal ORDER BY id desc "); while ($row = mysql_fetch_array($result)) { $ind=!$ind; $mycolor='"'.$col[$ind].'"';
echo "<tr >"; //echo "<td width='30' bgcolor=$mycolor
>".$row[0]."</td>"; echo "<td width='150' bgcolor=$mycolor'>".$row[1]."</td>"; echo "<td width='50' bgcolor=$mycolor>".$row[2]."</td>"; if ($row[3] ==null ) {echo "<td width='100' bgcolor=$mycolor><form action='' method='post' name='fdosh'><input type='edit' name='Dosh teq trenajer1' > <input type='submit' value='ok' name='Dosh1'></form></td>";} else {echo "<td width='100' bgcolor=$mycolor>".$row[3]."</td>";} echo "<td width='100' bgcolor=$mycolor>".$row[4]."</td>"; echo "<td width='100' bgcolor=$mycolor>".$row[5]."</td>"; echo "<td width='100' bgcolor=$mycolor>".$row[6]."</td>";
echo "</tr>"; }
echo "</table>";
?>