Dlaczego w funkcji id() nie są widoczne zmienne $title oraz $text mimo, że są zadeklarowane jako globalne? Natomiast zmienna $id jest widoczna (IMG:
http://forum.php.pl/style_emoticons/default/ohmy.gif)
<?php
#=====================================================#
$id = $_GET['id'];
#=====================================================#
$sql = mysql_query("SELECT text FROM articles WHERE id = '$id' "); $text = $select['text'];
$sql2 = mysql_query("SELECT title FROM articles WHERE id = '$id' "); $title = $select2['title'];
#=====================================================#
<form method="post">
<table align="center" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="text">Tytuł: </td>
<td><input type="Text" name="title" value='.$title.'></td>
<tr>
<td class="text">Treść: </td>
<td align="center"><TEXTAREA NAME="text" COLS="70" ROWS="10">'.$text.'</TEXTAREA></td>
</tr>
<tr>
<td colspan="3" align="center"><br><input type="Submit" name="submit" value="Aktualizuj"></td>
</tr>
</table></form>';
#=====================================================#
{
id($_GET['id']);
}
#=====================================================#
function id() {
else {
$updat = $title;
$update = "UPDATE articles SET title = '$updat' WHERE id = '$id'";
$updat2 = $text;
$update = "UPDATE articles SET text = '$updat2' WHERE id = '$id'";
header("Location: admin.php?go=edit"); }
}
#=====================================================#
?>