<?php
$listing;
$i;
$checkde;
$radio;
if(isset($_POST['save']))
header ("Location: xls_upload.php");
?>
<html>
<table border="1">
<form action="" method="post"
<thead>
<style>
br {
mso-data-placement:same-cell;
}
.style0 {
mso-number-format:General;
white-space:nowrap;
mso-style-id:0;
}
td {
mso-style-parent:style0;
mso-number-format:"@";
text-align: left;
}
td.date {
mso-number-format:"dd.mm.yyyy";
}
td.time {
mso-number-format:"[h]:mm:ss";
}
.number {
mso-number-format:"0";
}
</style>
<tr>
<th>Имя</th>
<th>Телефон</th>
<th>E-Mail</th>
<th>Заказанный номер</th>
<th>Оформлен</th>
<th>Отказ</th>
<th>Исполнен</th>
</tr>
</thead>
<tbody>
<?
startx();
function startx(){
require "bd.php";
global $listing,$i,$checkde,$radio;
$result=mysql_query('SELECT * FROM restore');
$yes = $_POST["yes"];
while($row=mysql_fetch_array($result))
{
require "bd.php";
$i++;
$javascript="<script type='text/javascript'>\nfunction updatediv(text,divnumber)\n {var selector='yesno'+divnumber;\ndocument.getElementsByName(selector)[0].innerHTML=text;\n}\n</script>\n";
$listing = "<tr><td>".$row['lex_name']."</td>. <td>".$row['lex_phone']."</td>. <td>".$row['lex_email']."</td><td>".$row['restore']."</td><td>"." <input type='radio' name='ok".$i."' value='yes' onClick='updatediv(".'"да",'.$i.");'></td><td><input type='radio' name='ok".$i."' value='no' onClick='updatediv(".'"нет",'.$i.")'></td><td><div name='yesno".$i."'>Нет</div></td></tr>";
$radio[$i] = $_POST['ok'.$i];
$nom_tel[$i] = $row['restore'];
echo $javascript;
echo $listing;
}
if (isset($_POST['yes'])){
$kol_vo = mysql_query('SELECT COUNT(*) FROM restore');
$result1=mysql_query('SELECT * FROM restore');
while($row=mysql_fetch_array($result1)){
$a++;
if($radio[$a] == "yes"){
mysql_query("UPDATE restore SET nom_yes_no = 'yes' WHERE restore = ".$nom_tel[$a]." ");
}
if($radio[$a] == "no"){
mysql_query("DELETE FROM restore WHERE restore = '$nom_tel[$a]' ");
}
}
echo '<meta http-equiv="refresh" content="0;url=LexSon_View.php" />';
}
}
?>
</tbody>
</table>
</br>
<div align = 'center'><input type ='submit' value = 'Внести' name='yes' </div>
<div align = 'center'><input type ='submit' value = 'Сохранить в excel' name='save' </div></form>
</html>
Говнокод, согласен, но работает, сейчас начну его по нормальному переписывать ))
А так, все работает, то что надо)