mam mały problem z dodaniem do bazy danch nie wiem gdzie jest błąd w każdym bądź razie dane z formularza są przekazywane globalnie i przez funkcję zmieniającą wpis w bazie sa odczytane prawidłowo, nie chce nationas się wykonać wpis do bazy i nie wiem czemu
plik admin/option.adm.php
<?php
$katalog = 'theme';
function option_form()
{
global $katalog, $title_, $key_word_, $describe_, $footer_, $theme_;
$dir = $katalog.'/';
while (false !== ($entry = $d->read()))
{
if( is_dir( $dir.$entry ) && $entry != '.' && $entry != '..' ) {
$fileArray[] = $entry;
}
}
$d->close();
$query = "SELECT * FROM config WHERE cfg='1'";
$title = $r['title'];
$footer = $r['footer'];
$describe = $r['describe'];
$key_word = $r['key_word'];
$theme = $r['theme'];
<br>
<fieldset>
<form action="admin.php?mod=option&action=change" method="POST" name="zmiana">
<legend>Pozostałe ustawienia</legend>
<table width="100% align="center">
<tr>
<td width="45%" align="right" valign="top" size="30">Tytuł strony</td>
<td width="55%" align="left"><input type="text" name="title_" value="'.$title.'"></td>
</tr>
<tr>
<td width="45%" align="right" valign="top" size="30">Stopka strony</td>
<td width="55%" align="left"><input type="text" name="footer_" value="'.$footer.'"></td>
</tr>
<tr>
<td width="45%" align="right" valign="top">Słowa kluczowe</td>
<td width="55%" align="left"><input type="text" size="30" name="key_word_" value="'.$key_word.'"></td>
</tr>
<tr>
<td width="45%" align="right" valign="top">Opis</td>
<td width="55%" align="left"><input type="text" size="30" name="describe_" value="'.$describe.'"></td>
</tr>
<tr>
<td width="45%" align="right" valign="top">Skórka</td>
<td width="55%" align="left">
<SELECT name="theme_">';
foreach ($fileArray as $name)
{
if ($name == $theme) {$e = 'SELECTED';}
'<OPTION VALUE="'.$name.'" '.$e.'>'.$name;
}
'</SELECT></td>
</tr>
<tr>
<td width="45%" align="right" valign="top"></td>
<td width="55%" align="left"><input type="submit" value="zmień"></td>
</tr>
</table>
</form>
</fieldset>
';
}
function option_change()
{
global $title_, $key_word_, $describe_, $footer_, $theme_; if ($title_ == '' || $key_word_ == '' || $describe_ == '' || $footer_ == '' || $theme_ == '')
{
echo '<strong>Błąd: musisz wypełnic wszystkie pola</strong>'; }
$query = "UPDATE config SET title='$title_', key_word='$key_word_', describe='$describe_', footer='$footer_', theme='$theme_' WHERE cfg='1'";
/*header("Location: admin.php?mod=others");
exit;*/
}
?>
fragment pliku admin.php
<?php
if ($_GET['mod']=='option')
{
include_once('admin/option.adm.php');
option_form();
if($_GET['action']=='change')
{
option_change();
}
}
?>