Ok so i run a topsite and in the admin interface i have my list of categories, i made a new field to add category description to each one. The data is entered into the correct category database field. But it aint display on the site next the category. Iam pretty much sure i forgot something, would be very cool if someone can look into it as iam pretty new to php. i highlight the stuff i added. This is the html ( within the php ) that should show category name, description, skin used. $categories_menu = '<table cellspacing="0" cellpadding="0" width="100%">'; foreach ($CONF['categories'] as $cat => $skin) { $skins_menu = $this->skins_menu($skin); $cat_url = urlencode($cat); $categories_menu .= <<<EndHTML <tr> <td valign="top" width="20%">{$cat}</td> [B]<td valign="top" width="20%">{$cat_description}</td>[/B] <td valign="top" width="30%"><a href="index.php?a=admin&b=skins&c=edit&cat={$cat_url}">{$LNG['a_man_edit']}</a> <a href="index.php?a=admin&b=skins&c=delete&cat={$cat_url}">{$LNG['a_man_delete']}</a></td> <td valign="top" width="30%"> <select name="skin_{$cat}"> <option value="">{$LNG['a_skins_default']}</option> {$skins_menu}</select><br /><br /> </td> </tr> EndHTML; } $categories_menu .= '</table>'; Code (markup): This is the edit category page wher i can enter the description, so its submitted to the database. It also dont show the text if i was entered allready before on the form field ( value ) function edit_category() { global $CONF, $DB, $FORM, $LNG, $TMPL; if (!isset($FORM['submit'])) { $cat = $DB->escape($FORM['cat']); [B]$cat_description = $DB->escape($FORM['cat_description']);[/B] $cat_url = urlencode($cat); $TMPL['admin_content'] = <<<EndHTML <form action="index.php?a=admin&b=skins&c=edit&cat={$cat_url}" method="post"> <fieldset> <legend>{$LNG['a_skins_edit_category']}</legend> <label>{$LNG['a_skins_category_name']}<br /> <input type="text" name="new_cat" size="20" value="{$FORM['cat']}" /><br /><br /> </label> [B]<label>Category Description<br /> <input type="text" name="new_cat_description" size="20" value="{$FORM['cat_description']}" /><br /><br /> </label>[/B] <input type="submit" name="submit" value="{$LNG['a_skins_edit_category']}" /> </fieldset> </form> EndHTML; } else { $category = $DB->escape($FORM['cat']); $new_category = $DB->escape($FORM['new_cat']); [B] $cat_description = $DB->escape($FORM['cat_description']); $new_cat_description = $DB->escape($FORM['new_cat_description']);[/B] $DB->query("UPDATE {$CONF['sql_prefix']}_categories SET category = '{$new_category}' WHERE category = '{$category}'", __FILE__, __LINE__); $DB->query("UPDATE {$CONF['sql_prefix']}_sites SET category = '{$new_category}' WHERE category = '{$category}'", __FILE__, __LINE__); [B]$DB->query("UPDATE {$CONF['sql_prefix']}_categories SET cat_description = '{$new_cat_description}' WHERE category = '{$category}'", __FILE__, __LINE__);[/B] $TMPL['admin_content'] = $LNG['a_skins_edit_done']; } } Code (markup): Iam not sure if someone is able to help just by viewing this code, if so please let me know. I personally think its not displayed, because the script dont know what {$cat_description} is. I think i would need to make a mysql query, but to display the categories there is no query as well, so iam confused :/ Thanks, Seb
Seb, On this line: $cat_description = $DB->escape($FORM['cat_description']); Do this: $cat_description = $DB->escape($FORM['cat_description']); echo "Cat description is: " . $cat_description . "<br/>"; What is its output? Is it blank? If so, you may have in your form the wrong name and they don't bind (i.e. match)?
thanks for your help, but it aint work. and i know why as well by the time. the $FORM thing is just used for a url variable. Guess i need to pla around a little more.