Inca o problema. Am un form pe care ,depinzand de ceea ce vreau sa fac pot EDITA sau ADAUGA noi autori. Edit merge, sa adaug NU , desi nu vad nimic gresit.
Codul paginii html , unde apare form-ul pentru edit/adaugare.
si codul care realizeaza inserarea in db :Cod PHP:<h1><?php htmlout($pagetitle); ?></h1>
<form action="?<?php htmlout($action); ?>" method="post">
<div>
<label for="name">Name: <input type="text" name="name" id="name" value="<?php htmlout($name); ?>"/></label>
</div>
<div>
<label for="email">Email: <input type="text" name="email" id="email" value="<?php htmlout($email); ?>"/></label>
</div>
<div>
<input type="hidden" name="id" value="<?php
htmlout($id); ?>"/>
<input type="submit" value="<?php htmlout($button); ?>"/>
</div>
</form>
LE : rezolvat , in loc sa folsoesc get am folosit POST.Cod PHP:if (isset($_GET['adauga']))
{
$pagetitle = 'New Author';
$action = 'adauga';
$name = '';
$email = '';
$id = '';
$button = 'Adauga autor';
include 'manageauthors.html.php';
exit();
}
if(isset($_POST['adauga']))
{ include $_SERVER['DOCUMENT_ROOT'] . '/includes/db.inc.html.php';
$name = mysqli_real_escape_string($connect, $_POST['name']);
$email = mysqli_real_escape_string($connect, $_POST['email']);
$sql = "INSERT INTO authors SET
name='$name',
email='$email'";
if(!mysqli_query($connect, $sql))
{$error = 'Nu pot adauga autorul in baza de date' . mysqli_error($connect);
include $_SERVER['DOCUMENT_ROOT'] . '/error.html.php';
exit();
}
acum am alta problema : am la fiecare dupa ce se executa ceea ce am de facut ,header('Location: .'); ca sa ma duca la pagina anterioara,practic un refresh , f util . Dar imi da Warning: Cannot modify header information - headers already sent by (output started at /home/football/public_html/admin/authors/authors.html.php:14) in /home/football/public_html/admin/authors/index.php on line 76
codul din authors.html.php linia 14 :
si linia 76 din index.php e header('Location: .');Cod PHP:<?php foreach($authors as $author):?>
stie cineva de la ce e?




Răspunde cu citat