Kod
<html>
<head>
<style>
p { width:400px; }
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body><?php
ini_set('display_errors', '0');
session_start(); //start sesji
ob_start();
include('connect.php');
$zapytanie = mysql_query("SELECT * FROM user WHERE login='".$_SESSION['login']."'");
$wynik = mysql_fetch_array($zapytanie);
?>
<center>
<script>
$("button").click(function () {
$("p").slideToggle("slow");
});
</script><a href="index.php">Strona glowna</a> | <a href="dodaj.php">Dodaj</a> | <a href="aktualizuj.php">Aktualizuj ilosc</a> | <?php
if (isset($_SESSION['user_id']) and isset($_SESSION['login']))
{
echo '<a href="wyloguj.php">Wyloguj sie</a>';
}
else
{
echo '<a href="login.php">Zaloguj sie</a>';
}?><br>
<?php
$zapytanie2 = mysql_query("SELECT * FROM spis WHERE id='" . $_POST['id'] . "'");
$row = mysql_fetch_row($zapytanie2);
if($_POST['checkil'] == 1)
{
mysql_query("UPDATE spis SET ilosc='" . $_POST['il'] . "' WHERE id='" . $_POST['id'] . "'");
echo "Aktualna ilosc rozmiaru: <b>" . $row[1] . "</b>, wynosi: <b>". $_POST['il'] ."</b>";
}
if($_POST['cenabuy'] == 1)
{
mysql_query("UPDATE spis SET cenabuy='" . $_POST['cenab'] . "' WHERE id='" . $_POST['id'] . "'");
echo "Rozmiar: <b>" . $row[1] . "</b>, byl kopiony za: <b>". $_POST['cenab'] ."</b>";
}
if($_POST['cenasell'] == 1)
{
mysql_query("UPDATE spis SET cenasell='" . $_POST['cenas'] . "' WHERE id='" . $_POST['id'] . "'");
echo "Rozmiar: <b>" . $row[1] . "</b>, kosztuje teraz: <b>". $_POST['cenas'] ."</b>";
}
if($_GET['usun']=='tak')
{
mysql_query("DELETE FROM spis WHERE id='".$_GET['id']."';");
header("Location:index.php");
}
$zapytanie2 = mysql_query("SELECT * FROM spis ORDER BY rozmiar ASC");
if (isset($_SESSION['user_id']) and isset($_SESSION['login']))
{
echo "<table border=\"1\"><tr>";
echo "<th width=\"30\"><strong><center>ID</center></strong></th>";
echo "<th width=\"150\"><strong><center>Rozmiar</center></strong></th>";
echo "<th width=\"150\"><strong><center>Cena kupna</center></strong></th>";
echo "<th width=\"150\"><strong><center>Cena sprzedazy</center></strong></th>";
echo "<th width=\"150\"><strong><center>Ilosc</center></strong></th>";
echo "<th width=\"200\"><strong><center>Akcja</center></strong></th>";
echo "</tr>";
while ( $row = mysql_fetch_row($zapytanie2) )
{
echo "<tr>";
echo "<td width=\"30\">" . $row[0] . "</td>";
echo "<td width=\"150\">" . $row[1] . "</td>";
echo "<td width=\"150\">" . $row[2] . "</td>";
echo "<td width=\"150\">" . $row[3] . "</td>";
echo "<td width=\"150\">" . $row[4] . "</td>";
echo'<td width=\"200\"><a href="?usun=tak&id='.$row[0].'"><img src="cancel.png" title="Usuń"></a>'?>
<button id="zi">Ilosc</button>
<div id="1" style="display:none;">
<form method="POST">
<table>
<tr>
<td>ID:</td> <td><input type="text" name="id" size="3"></td>
</tr>
<tr>
<td>Ilosc:</td> <td><input type="text" name="il" size="3"></td>
</tr>
<tr>
<td></td> <td><input type="hidden" name="checkil" value="1"><input type="submit" value="Wyslij"></td>
</tr>
</table>
</form></div>
<script>
$("button#zi").click(function ()
{
$("#1").slideToggle("slow");
});
</script>
<button id="ck">Kupno</button>
<div id="2" style="display:none;">
<form method="POST">
<table>
<tr>
<td>ID:</td> <td><input type="text" name="id" size="3"></td>
</tr>
<tr>
<td>Cena:</td> <td><input type="text" name="cenab" size="3"></td>
</tr>
<tr>
<td></td> <td><input type="hidden" name="cenabuy" value="1"><input type="submit" value="Wyslij"></td>
</tr>
</table>
</form></div>
<script>
$("button#ck").click(function ()
{
$("#2").slideToggle("slow");
});
</script>
<button id="cs">Sprzedaz</button>
<div id="3" style="display:none;">
<form method="POST">
<table>
<tr>
<td>ID:</td> <td><input type="text" name="id" size="3"></td>
</tr>
<tr>
<td>Cena:</td> <td><input type="text" name="cenas" size="3"></td>
</tr>
<tr>
<td></td> <td><input type="hidden" name="cenasell" value="1"><input type="submit" value="Wyslij"></td>
</tr>
</table>
</form></div>
<script>
$("button#cs").click(function ()
{
$("#3").slideToggle("slow");
});
</script></td><?php
echo "</tr>";
}
echo '</table></center>';
}
else
{
echo "<table border=\"1\"><tr>";
echo "<th width=\"30\"><strong><center>ID</center></strong></th>";
echo "<th width=\"150\"><strong><center>Rozmiar</center></strong></th>";
echo "<th width=\"150\"><strong><center>Cena sprzedazy</center></strong></th>";
echo "<th width=\"150\"><strong><center>Ilosc</center></strong></th>";
echo "<th width=\"200\"><strong><center>Akcja</center></strong></th>";
echo "</tr>";
while ( $row = mysql_fetch_row($zapytanie2) ) {
echo "<tr>";
echo "<td width=\"150\">" . $row[0] . "</td>";
echo "<td width=\"150\">" . $row[1] . "</td>";
echo "<td width=\"150\">" . $row[3] . "</td>";
echo "<td width=\"200\">" . $row[4] . "</td>";
echo '<td width=\"150\"><a href="?usun=tak&id='.$row[0].'"><img src="cancel.png" title="Usuń"></a>';?>
<button id="zi">Ilosc</button>
<div id="1" style="display:none;">
<form method="POST">
<table>
<tr>
<td>ID:</td> <td><input type="text" name="id" size="3"></td>
</tr>
<tr>
<td>Ilosc:</td> <td><input type="text" name="il" size="3"></td>
</tr>
<tr>
<td></td> <td><input type="hidden" name="checkil" value="1"><input type="submit" value="Wyslij"></td>
</tr>
</table>
</form></div>
<script>
$("button#zi").click(function ()
{
$("#1").slideToggle("slow");
});
</script>
</td><?php
echo "</tr>";
}
echo '</table></center>';
}
ob_end_flush(); ?>
</body>
</html>
<head>
<style>
p { width:400px; }
</style>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body><?php
ini_set('display_errors', '0');
session_start(); //start sesji
ob_start();
include('connect.php');
$zapytanie = mysql_query("SELECT * FROM user WHERE login='".$_SESSION['login']."'");
$wynik = mysql_fetch_array($zapytanie);
?>
<center>
<script>
$("button").click(function () {
$("p").slideToggle("slow");
});
</script><a href="index.php">Strona glowna</a> | <a href="dodaj.php">Dodaj</a> | <a href="aktualizuj.php">Aktualizuj ilosc</a> | <?php
if (isset($_SESSION['user_id']) and isset($_SESSION['login']))
{
echo '<a href="wyloguj.php">Wyloguj sie</a>';
}
else
{
echo '<a href="login.php">Zaloguj sie</a>';
}?><br>
<?php
$zapytanie2 = mysql_query("SELECT * FROM spis WHERE id='" . $_POST['id'] . "'");
$row = mysql_fetch_row($zapytanie2);
if($_POST['checkil'] == 1)
{
mysql_query("UPDATE spis SET ilosc='" . $_POST['il'] . "' WHERE id='" . $_POST['id'] . "'");
echo "Aktualna ilosc rozmiaru: <b>" . $row[1] . "</b>, wynosi: <b>". $_POST['il'] ."</b>";
}
if($_POST['cenabuy'] == 1)
{
mysql_query("UPDATE spis SET cenabuy='" . $_POST['cenab'] . "' WHERE id='" . $_POST['id'] . "'");
echo "Rozmiar: <b>" . $row[1] . "</b>, byl kopiony za: <b>". $_POST['cenab'] ."</b>";
}
if($_POST['cenasell'] == 1)
{
mysql_query("UPDATE spis SET cenasell='" . $_POST['cenas'] . "' WHERE id='" . $_POST['id'] . "'");
echo "Rozmiar: <b>" . $row[1] . "</b>, kosztuje teraz: <b>". $_POST['cenas'] ."</b>";
}
if($_GET['usun']=='tak')
{
mysql_query("DELETE FROM spis WHERE id='".$_GET['id']."';");
header("Location:index.php");
}
$zapytanie2 = mysql_query("SELECT * FROM spis ORDER BY rozmiar ASC");
if (isset($_SESSION['user_id']) and isset($_SESSION['login']))
{
echo "<table border=\"1\"><tr>";
echo "<th width=\"30\"><strong><center>ID</center></strong></th>";
echo "<th width=\"150\"><strong><center>Rozmiar</center></strong></th>";
echo "<th width=\"150\"><strong><center>Cena kupna</center></strong></th>";
echo "<th width=\"150\"><strong><center>Cena sprzedazy</center></strong></th>";
echo "<th width=\"150\"><strong><center>Ilosc</center></strong></th>";
echo "<th width=\"200\"><strong><center>Akcja</center></strong></th>";
echo "</tr>";
while ( $row = mysql_fetch_row($zapytanie2) )
{
echo "<tr>";
echo "<td width=\"30\">" . $row[0] . "</td>";
echo "<td width=\"150\">" . $row[1] . "</td>";
echo "<td width=\"150\">" . $row[2] . "</td>";
echo "<td width=\"150\">" . $row[3] . "</td>";
echo "<td width=\"150\">" . $row[4] . "</td>";
echo'<td width=\"200\"><a href="?usun=tak&id='.$row[0].'"><img src="cancel.png" title="Usuń"></a>'?>
<button id="zi">Ilosc</button>
<div id="1" style="display:none;">
<form method="POST">
<table>
<tr>
<td>ID:</td> <td><input type="text" name="id" size="3"></td>
</tr>
<tr>
<td>Ilosc:</td> <td><input type="text" name="il" size="3"></td>
</tr>
<tr>
<td></td> <td><input type="hidden" name="checkil" value="1"><input type="submit" value="Wyslij"></td>
</tr>
</table>
</form></div>
<script>
$("button#zi").click(function ()
{
$("#1").slideToggle("slow");
});
</script>
<button id="ck">Kupno</button>
<div id="2" style="display:none;">
<form method="POST">
<table>
<tr>
<td>ID:</td> <td><input type="text" name="id" size="3"></td>
</tr>
<tr>
<td>Cena:</td> <td><input type="text" name="cenab" size="3"></td>
</tr>
<tr>
<td></td> <td><input type="hidden" name="cenabuy" value="1"><input type="submit" value="Wyslij"></td>
</tr>
</table>
</form></div>
<script>
$("button#ck").click(function ()
{
$("#2").slideToggle("slow");
});
</script>
<button id="cs">Sprzedaz</button>
<div id="3" style="display:none;">
<form method="POST">
<table>
<tr>
<td>ID:</td> <td><input type="text" name="id" size="3"></td>
</tr>
<tr>
<td>Cena:</td> <td><input type="text" name="cenas" size="3"></td>
</tr>
<tr>
<td></td> <td><input type="hidden" name="cenasell" value="1"><input type="submit" value="Wyslij"></td>
</tr>
</table>
</form></div>
<script>
$("button#cs").click(function ()
{
$("#3").slideToggle("slow");
});
</script></td><?php
echo "</tr>";
}
echo '</table></center>';
}
else
{
echo "<table border=\"1\"><tr>";
echo "<th width=\"30\"><strong><center>ID</center></strong></th>";
echo "<th width=\"150\"><strong><center>Rozmiar</center></strong></th>";
echo "<th width=\"150\"><strong><center>Cena sprzedazy</center></strong></th>";
echo "<th width=\"150\"><strong><center>Ilosc</center></strong></th>";
echo "<th width=\"200\"><strong><center>Akcja</center></strong></th>";
echo "</tr>";
while ( $row = mysql_fetch_row($zapytanie2) ) {
echo "<tr>";
echo "<td width=\"150\">" . $row[0] . "</td>";
echo "<td width=\"150\">" . $row[1] . "</td>";
echo "<td width=\"150\">" . $row[3] . "</td>";
echo "<td width=\"200\">" . $row[4] . "</td>";
echo '<td width=\"150\"><a href="?usun=tak&id='.$row[0].'"><img src="cancel.png" title="Usuń"></a>';?>
<button id="zi">Ilosc</button>
<div id="1" style="display:none;">
<form method="POST">
<table>
<tr>
<td>ID:</td> <td><input type="text" name="id" size="3"></td>
</tr>
<tr>
<td>Ilosc:</td> <td><input type="text" name="il" size="3"></td>
</tr>
<tr>
<td></td> <td><input type="hidden" name="checkil" value="1"><input type="submit" value="Wyslij"></td>
</tr>
</table>
</form></div>
<script>
$("button#zi").click(function ()
{
$("#1").slideToggle("slow");
});
</script>
</td><?php
echo "</tr>";
}
echo '</table></center>';
}
ob_end_flush(); ?>
</body>
</html>
I gdy mam 1 pozycje w tabeli to dobrze się otwiera, a gdy już wiecęj niż 1 to klikając na ostatnie otwiera się pierwsze, a gdy klikne przy pierwszym to zaczyna "latać" czyli idzie w dól, w górę i się otwiera pierwsze.