Hello,
I don't have any errors it just not showing a thing if i leave only the html code it works but in php it wont so if you can help me would be cool, Thanks =]
<?php
$a = trim($_REQUEST['a']);
$student = trim($_GET['student']);
if($a == 'edit' and !empty($id))
{
/* zapytanie do tabeli */
$wynik = mysql_query("SELECT * FROM table_name WHERE student='$student'")
or die('Błąd zapytania');
if(mysql_num_rows($wynik) > 0)
{
$r = mysql_fetch_assoc($wynik);
echo '<form action="edycja.php" method="post">
<input type="hidden" name="a" value="save" />
<input type="hidden" name="student" value="'.$student.'"/>
test1:<br />
<input type="text" name="test1" value="'.$r['test1'].'"/><br />
test2:<br />
<input type="text" name="test2" value="'.$r['test2'].'" /><br />
<input type="text" name="test3" value="'.$r['test3'].'" /><br />
<input type="submit" value="popraw" />
</form>';
}
}
elseif($a == 'save')
{
/* odbieramy zmienne z formularza */
$student = $_POST['student'];
$test1 = trim($_POST['test1']);
$test2 = trim($_POST['test2']);
$test3 = trim($_POST['test3']);
/* uaktualniamy tabelę test */
mysql_query("UPDATE test SET test1='$test1',
test2='$test2, test3='$test3' WHERE student='$student'")
or die('Błąd zapytania');
echo 'Dane zostały zaktualizowane';
}
?>