como faço para definir variavel $f nesse codigo
Notice: Undefined variable: f in C:\wamp\www\cursos\prophp\projeto\admin\posts\categorias-create.php
<?php
/**
* Se não existe a função, redireciona para o index2.php
*/
if ( !function_exists('getUser') ):
header('Location: ../index2.php');
endif;
?>
<!-- INICIA O BLOCO //-->
<div class="bloco form" style="display:block">
<?php/*
* O usuário tem autorização ?
*/
if ( getUser($_SESSION['autUser']['id'], '1') ): ?>
<div class="titulo">criar categoria:
<a href="index2.php?exe=posts/categorias" title="criar nova categoria" class="btn" style="float:right;">voltar</a>
</div>
<?php
if (isset($_POST['sendForm'])) {
$f['nome'] = htmlspecialchars($_POST['nome']);
$f['content'] = htmlspecialchars($_POST['content']);
$f['tags'] = htmlspecialchars($_POST['tags']);
$f['date'] = htmlspecialchars($_POST['data']);
if (in_array('', $f)) {
echo '<span class="ms al">Desculpe,voce não tem permissão para gerenciar categorias!</span>';
} else {
$f['data'] = formDate($f['date']);
unset($f['date']);
$f['url'] = setUri($f['nome']);
$readCatUri = read('up_cat', "WHERE url LIKE '%$f[url]%'");
if ($readCatUri) {
$f['url'] = $f['url'] . '-' . count($readCatUri);
$readCatUri = read('up_cat', "WHERE url ='$f[url]'");
if ($readCatUri) {
$f['url'] = $f['url'] . '-' . time();
}
}
create('up_cat', $f);
echo '<span class="ms al">categorias criada com suscesso!</span>';
}
}
?>
<form name="formulario" action="" method="post">
<label class="line">
<span class="data">Nome:</span>
<input type="text" name="nome" value="<?php if ($f['nome']) echo $f['nome']; ?>" />
</label>
<label class="line">
<span class="data">Descrição:</span>
<textarea name="content" rows="3"><?php if ($f['content']) echo $f['content']; ?></textarea>
</label>
<label class="line">
<span class="data">Tags:</span>
<input type="text" name="tags" value="<?php if ($f['tags']) echo $f['tags']; ?>" />
</label>
<label class="line">
<span class="data">Data:</span>
<input type="text" name="data" value="<?php if ($f['date']) {
echo $f['date'];
} else {
echo date('d/m/y H:i:s');
} ?>" />
</label>
<input type="submit" value="send" name="sendForm" class="btn" />
</form>
<?php/**
* Ele não tem permissão
*/
else:
echo '<span class="ms al">Desculpe,voce não tem permissão para gerenciar categorias!</span>';
endif;
?>
</div><!-- /bloco form -->
</body>
</html>Discussão (6)
Carregando comentários...