Warning: Cannot modify header information - headers already sent by (output started at /var/www/inventory/index.php:11) in /var/www/inventory/index.php on line 36
Dit komt doordat header niet als eerste verzonden word naar de browser heeft google me al geleerd.
ziehier de code:
<?
include('connect.php');
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="basic.css">
</head>
<body>
<h1>Domains</h1>
<h2>List of the domains</h2>
<?
$requete = "SELECT COUNT(DISTINCT zone) FROM dns_records";
$res = mysql_query($requete);
$ligne = mysql_fetch_array($res);
echo '<p>There are ' .$ligne["COUNT(DISTINCT zone)"]. ' domains.</p>';
?>
<p>Add a new domain :</p>
<form action="index.php" method="post">
<input type="text" name="add_domain">
<input type="submit" value="Add" name="add_domains" />
</form>
<?
if ($_POST['add_domains'])
{
$add_domain=$_POST['add_domain'];
$req = "SELECT COUNT(DISTINCT zone) FROM dns_records where zone like '$add_domain'";
$res = mysql_query($req);
$ligne = mysql_fetch_array($res);
$zone=$ligne["COUNT(DISTINCT zone)"];
if ($zone != 0) { echo "<p>This domain already exists!!!</p>"; } else
{
$requete = "INSERT INTO dns_records VALUES('0','$add_domain','@','86400','SOA','','ns1.webcommercedns.be.','peter.','2','28000','2800','64800','10'),
('0','$add_domain','@','86400','NS','','ns1.webcommercedns.be.','','','','','',''),
('0','$add_domain','@','86400','NS','','ns2.webcommercedns.be.','','','','','','')";
mysql_query($requete) or die ('Erreur lors de l\'insertion');
header('Location: domain.php?domain=$add_domain');
};
...
Kan ik dit dan op een andere manier nog doen of zien jullie een oplossing?