Autor Zpráva
Jarda[K]
Profil *
Ahoj,
poraďte mi prosim někdo. Kde je chyba? Nefunguje mi pouze prikaz UPDATE, jinak vse funguje spravne.
Diky moc
Jarda



<?php

mysql_connect('xxx','xxx','xxx');
mysql_select_db("xxx");

if(isset($_POST['edit_ZP'])) {
//
//
$IDCentra= addslashes($_POST['IDCentra']);
$VZP= addslashes($_POST['VZP']);
$VoZP= addslashes($_POST['VoZP']);
$HZP= addslashes($_POST['HZP']);
$OZP= addslashes($_POST['OZP']);
$ZPS= addslashes($_POST['ZPS']);
$ZPMVCR= addslashes($_POST['ZPMVCR']);
$RBPZP= addslashes($_POST['RBPZP']);
$ZPMA= addslashes($_POST['ZPMA']);
$CNZP= addslashes($_POST['CNZP']);


mysql_query("UPDATE lk_centra SET VZP = '$VZP', VoZP = '$VoZP̈́', HZP = '$HZP', OZP = '$OZP', ZPS = '$ZPS',
ZPMVCR = '$ZPMVCR',RBPZP = '$RBPZP', ZPMA = '$ZPMA', CNZP ='$CNZP' WHERE IDCentra='$IDCentra'");
}

$data1=mysql_query("SELECT NazevPrac, ICZ, Oddeleni, VZP, VoZP, HZP, OZP, ZPS, ZPMVCR, RBPZP, ZPMA, CNZP FROM lk_centra");
while ($zaznam=mysql_fetch_array($data1))
         {
echo "
<form action='#' method='post'>
<table class='tb_sr'>

<tr>

<td colspan='3'>
<strong>Název zařízení:</strong><br/><input type='text' readonly='readonly' name='NazevPrac' value='".$zaznam['NazevPrac']."'
<input type='hidden' name='IDCentra' value='".$zaznam['IDCentra']."'>
</td>
<td colspan='3'>
<strong>IČZ:</strong><br/><input type='text' readonly='readonly' name='ICZ' value='".$zaznam['ICZ']."'
</td>
<td colspan='3'>
<strong>Oddělení:</strong><br/><input type='text' readonly='readonly' name='Oddeleni' value='".$zaznam['Oddeleni']."'
</td>
<td rowspan='3'>
<input class='i_tridit' type='submit' name='edit_ZP' value='Uložit'>
</td>

</tr>

<tr>

<td>
<strong>VZP:</strong>
<br/>
Ano<input type='radio' name='VZP' value='Ano' ";
if($zaznam['VZP'] == 'Ano') {
echo "checked='checked'";
}
echo ">&nbsp;Ne<input type='radio' name='VZP' value='Ne' ";
if($zaznam['VZP'] == 'Ne') {
echo "checked='checked'";
}
echo "></td>


<td>
<strong>VoZP:</strong>
<br/>
Ano<input type='radio' name='VoZP' value='Ano' ";
if($zaznam['VoZP'] == 'Ano') {
echo "checked='checked'";
}
echo ">&nbsp;Ne<input type='radio' name='VoZP' value='Ne' ";
if($zaznam['VoZP'] == 'Ne') {
echo "checked='checked'";
}
echo "></td>


<td>
<strong>HZP:</strong>
<br/>
Ano<input type='radio' name='HZP' value='Ano' ";
if($zaznam['HZP'] == 'Ano') {
echo "checked='checked'";
}
echo ">&nbsp;Ne<input type='radio' name='HZP' value='Ne' ";
if($zaznam['HZP'] == 'Ne') {
echo "checked='checked'";
}
echo "></td>


<td>
<strong>OZP:</strong>
<br/>
Ano<input type='radio' name='OZP' value='Ano' ";
if($zaznam['OZP'] == 'Ano') {
echo "checked='checked'";
}
echo ">&nbsp;Ne<input type='radio' name='OZP' value='Ne' ";
if($zaznam['OZP'] == 'Ne') {
echo "checked='checked'";
}
echo "></td>


<td>
<strong>ZPŠ:</strong>
<br/>
Ano<input type='radio' name='ZPS' value='Ano' ";
if($zaznam['ZPS'] == 'Ano') {
echo "checked='checked'";
}
echo ">&nbsp;Ne<input type='radio' name='ZPS' value='Ne' ";
if($zaznam['ZPS'] == 'Ne') {
echo "checked='checked'";
}
echo "></td>


<td>
<strong>ZPMV ČR:</strong>
<br/>
Ano<input type='radio' name='ZPMVCR' value='Ano' ";
if($zaznam['ZPMVCR'] == 'Ano') {
echo "checked='checked'";
}
echo ">&nbsp;Ne<input type='radio' name='ZPMVCR' value='Ne' ";
if($zaznam['ZPMVCR'] == 'Ne') {
echo "checked='checked'";
}
echo "></td>

<td>
<strong>RBP-ZP:</strong>
<br/>
Ano<input type='radio' name='RBPZP' value='Ano' ";
if($zaznam['RBPZP'] == 'Ano') {
echo "checked='checked'";
}
echo ">&nbsp;Ne<input type='radio' name='RBPZP' value='Ne' ";
if($zaznam['RBPZP'] == 'Ne') {
echo "checked='checked'";
}
echo "></td>


<td>
<strong>ZP M-A:</strong>
<br/>
Ano<input type='radio' name='ZPMA' value='Ano' ";
if($zaznam['ZPMA'] == 'Ano') {
echo "checked='checked'";
}
echo ">&nbsp;Ne<input type='radio' name='ZPMA' value='Ne' ";
if($zaznam['ZPMA'] == 'Ne') {
echo "checked='checked'";
}
echo "></td>


<td>
<strong>ČNZP:</strong>
<br/>
Ano<input type='radio' name='CNZP' value='Ano' ";
if($zaznam['CNZP'] == 'Ano') {
echo "checked='checked'";
}
echo ">&nbsp;Ne<input type='radio' name='CNZP' value='Ne' ";
if($zaznam['CNZP'] == 'Ne') {
echo "checked='checked'";
}
echo "></td></tr></table></form> ";
}
?>
Alphard
Profil
177 řádků kódu, delší nemáte? :-)
co vypisuje mysql_error()?
Jarda[K]
Profil *
Právě že nic :-(
Když změním hodnoty na jednotlivých radio, vrátí se do původního stavu podle DTB.
Je zvláštní, že když jsem místo radio používal input type='text' tak to fungovalo.
Jarda[K]
Profil *
Tak jsem to nakonec vyřešil trochu jiným zápise.m. Takto to funguje:

<?php
if(isset($_POST['edit_centra'])) {
$IDCentra=$_POST['IDCentra'];
//
//   

$VZP= addslashes($_POST['VZP']);
$VoZP= addslashes($_POST['VoZP']);
$HZP= addslashes($_POST['HZP']);
$OZP= addslashes($_POST['OZP']);
$ZPS= addslashes($_POST['ZPS']);
$ZPMVCR= addslashes($_POST['ZPMVCR']);
$RBPZP= addslashes($_POST['RBPZP']);
$ZPMA= addslashes($_POST['ZPMA']);
$CNZP= addslashes($_POST['CNZP']);

    
mysql_query("UPDATE lk_centra SET VZP='$VZP', VoZP='$VoZP', HZP='$HZP', OZP='$OZP', ZPS='$ZPS', ZPMVCR='$ZPMVCR', RBPZP='$RBPZP', ZPMA='$ZPMA', CNZP='$CNZP'
WHERE IDCentra='$IDCentra'");
                                 }


$data1=mysql_query("SELECT * FROM lk_centra");
echo("<table class='tb_sr'>");
while ($data=mysql_fetch_array($data1))
         {
   
echo("<form method='POST'><tr>");
         
         

echo("<td  colspan='9'>
<table>
<tr>
<td>
Název zařízení:<br/>
<input ' type='text' size='50' readonly='readonly' name='NazevPrac' value='".$data['NazevPrac']."'>
<input type='hidden' name='IDCentra' value='".$data['IDCentra']."'>
</td>
<td>
IČZ:<br/>
<input ' type='text' size='10' readonly='readonly' name='ICZ' value='".$data['ICZ']."'>
</td>
<td>
Oddělení:<br/>
<input ' type='text' size='50' readonly='readonly' name='Oddeleni' value='".$data['Oddeleni']."'></td>
</tr>
</table>
</td>
");


echo("<td  rowspan='3'><input class='i_tridit' type='submit' name='edit_centra' value='Uložit'></td></tr>");




echo("<tr><td  colspan='9'><b>Smluvní vztah:</b></td></tr>");





echo("<td><strong>VZP:</strong>
<br/>
Ano<input type='radio' name='VZP' value='Ano' ");
if($data['VZP'] == 'Ano') {
echo (" checked='checked'");
}
echo (">&nbsp;Ne<input type='radio' name='VZP' value='Ne' ");
if($data['VZP'] == 'Ne') {
echo (" checked='checked'");
}
echo ("></td>");

echo("<td ><strong>VoZP:</strong>
<br/>
Ano<input type='radio' name='VoZP' value='Ano' ");
if($data['VoZP'] == 'Ano') {
echo (" checked='checked'");
}
echo (">&nbsp;Ne<input type='radio' name='VoZP' value='Ne' ");
if($data['VoZP'] == 'Ne') {
echo (" checked='checked'");
}
echo ("></td>");

echo("<td ><strong>HZP:</strong>
<br/>
Ano<input type='radio' name='HZP' value='Ano' ");
if($data['HZP'] == 'Ano') {
echo (" checked='checked'");
}
echo (">&nbsp;Ne<input type='radio' name='HZP' value='Ne' ");
if($data['HZP'] == 'Ne') {
echo (" checked='checked'");
}
echo ("></td>");

echo("<td ><strong>OZP:</strong>
<br/>
Ano<input type='radio' name='OZP' value='Ano' ");
if($data['OZP'] == 'Ano') {
echo (" checked='checked'");
}
echo (">&nbsp;Ne<input type='radio' name='OZP' value='Ne' ");
if($data['OZP'] == 'Ne') {
echo (" checked='checked'");
}
echo ("></td>");

echo("<td ><strong>ZPŠ:</strong>
<br/>
Ano<input type='radio' name='ZPS' value='Ano' ");
if($data['ZPS'] == 'Ano') {
echo (" checked='checked'");
}
echo (">&nbsp;Ne<input type='radio' name='ZPS' value='Ne' ");
if($data['ZPS'] == 'Ne') {
echo (" checked='checked'");
}
echo ("></td>");

echo("<td ><strong>ZPMV ČR:</strong>
<br/>
Ano<input type='radio' name='ZPMVCR' value='Ano' ");
if($data['ZPMVCR'] == 'Ano') {
echo (" checked='checked'");
}
echo (">&nbsp;Ne<input type='radio' name='ZPMVCR' value='Ne' ");
if($data['ZPMVCR'] == 'Ne') {
echo (" checked='checked'");
}
echo ("></td>");

echo("<td ><strong>RBP-ZP:</strong>
<br/>
Ano<input type='radio' name='RBPZP' value='Ano' ");
if($data['RBPZP'] == 'Ano') {
echo (" checked='checked'");
}
echo (">&nbsp;Ne<input type='radio' name='RBPZP' value='Ne' ");
if($data['RBPZP'] == 'Ne') {
echo (" checked='checked'");
}
echo ("></td>");

echo("<td ><strong>ZP M-A:</strong>
<br/>
Ano<input type='radio' name='ZPMA' value='Ano' ");
if($data['ZPMA'] == 'Ano') {
echo (" checked='checked'");
}
echo (">&nbsp;Ne<input type='radio' name='ZPMA' value='Ne' ");
if($data['ZPMA'] == 'Ne') {
echo (" checked='checked'");
}
echo ("></td>");

echo("<td ><strong>ČNZP:</strong>
<br/>
Ano<input type='radio' name='CNZP' value='Ano' ");
if($data['CNZP'] == 'Ano') {
echo (" checked='checked'");
}
echo (">&nbsp;Ne<input type='radio' name='CNZP' value='Ne' ");
if($data['CNZP'] == 'Ne') {
echo (" checked='checked'");
}
echo ("></td></tr>");







 
 
 echo("<tr><td  colspan='10'>
 <hr noshade size='1' width='100%' align='left' color='#3a4fa2'>
 <br/>
 <hr noshade size='1' width='100%' align='left' color='#3a4fa2'>
</td>");
        
         
         echo("</tr></form>");
         }
echo("</table>");
?>
had
Profil *
hm...koukám že máte i delší zápis než jenom 177 řádků ;)

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm: