Er løbet ind i en dum fejl, jeg ikke kan løse. Har lavet lignende ting 100 gange før og aldrig haft problemer, men nu virker det sq ikke.
Mit problem er at jeg ikke kan få lagt nogle informationer ind i min db. Når jeg echoer fra formen virker det fint, men der kommer altså ikke noget ind i min db.
Her kommer sql syntax
<pre>
<?php
//ny nyhed Start
if ($_GET[side] == "nyhed")
{
include("config.php");
$link = mysql_connect($host, $brugernavn, $kodeord) or die(mysql_error());
$os = $_POST['overskrift'];
$af = $_POST['af'];
$bil = $_POST['billede'];
$kil = $_POST['kilde'];
$reg = $_POST['region'];
$kat = $_POST['kategori'];
$dag = $_POST['dag'];
$md = $_POST['måned'];
$år = $_POST['år'];
$for = $_POST['forord'];
$ind = $_POST['indhold'];
mysql_query("INSERT INTO nyheder
(overskrift, af, billede, kilde, region, kategori, dag, måned, år, forord, indhold)
VALUES(
'$_POST',
'$_POST[af]',
'$_POST[billede]',
'$_POST[kilde]',
'$_POST[region]',
'$_POST[kategori]',
'$_POST[dag]',
'$_POST[måned]',
'$_POST[år]',
'$_POST[forord]',
'$_POST[indhold]'
)
");
mysql_close ($link);
echo "$os
$af, $bil, $kil, $reg, $kat, $dag, $md, $år, $for, $ind";
}
//ny nyhed Slut
?>
</pre>
Her kommer config.php
<pre>
<?
$host = "localhost";
$brugernavn = "";
$kodeord = "";
$database = "metro";
mysql_connect($host,$brugernavn,$kodeord);
mysql_select_db($database);
?>
</pre>
Anders!
Glemte lige formen!
<pre>
if($_GET[side] == "1")
{
echo "<form method=\\"post\\" action=\\"func.php?side=nyhed\\">";
echo "<input name=\\"overskrift\\" type=\\"text\\" value=\\"Overskrift\\" size=\\"40\\" />";
echo "";
echo "<input name=\\"af\\" type=\\"text\\" value=\\"Dit Navn\\" size=\\"40\\" />";
echo "";
echo "<input name=\\"user_file\\" type=\\"file\\" id=\\"user_file\\" size=\\"21\\"/>";
echo "";
echo "<input name=\\"kilde\\" type=\\"text\\" value=\\"Kilde\\" size=\\"40\\" />";
echo "";
echo "<select name=\\"region\\">";
echo "<option value=\\"Region\\">Region</option>";
echo "<option value=\\"Fyn\\">Fyn</option>";
echo "<option value=\\"Jylland\\">Jylland</option>";
echo "<option value=\\"Sjælland\\">Sjælland</option>";
echo "</select>";
echo "";
echo "<select name=\\"kategori\\">";
echo "<option value=\\"Kategori\\">Kategori</option>";
echo "<option value=\\"112\\">112</option>";
echo "<option value=\\"Erhverv\\">Erhverv</option>";
echo "<option value=\\"underholdning\\">Underholdning</option>";
echo "<option value=\\"sport\\">Sport</option>";
echo "</select>";
echo "";
echo "<select name=\\"dag\\">";
echo "<option value=\\"dag\\">Dag</option>";
echo "<option value=\\"1\\">1</option>";
echo "<option value=\\"2\\">2</option>";
echo "<option value=\\"3\\">3</option>";
echo "<option value=\\"4\\">4</option>";
echo "<option value=\\"5\\">5</option>";
echo "<option value=\\"6\\">6</option>";
echo "<option value=\\"7\\">7</option>";
echo "<option value=\\"8\\">8</option>";
echo "<option value=\\"9\\">9</option>";
echo "<option value=\\"10\\">10</option>";
echo "<option value=\\"11\\">11</option>";
echo "<option value=\\"12\\">12</option>";
echo "<option value=\\"13\\">13</option>";
echo "<option value=\\"14\\">14</option>";
echo "<option value=\\"15\\">15</option>";
echo "<option value=\\"16\\">16</option>";
echo "<option value=\\"17\\">17</option>";
echo "<option value=\\"18\\">18</option>";
echo "<option value=\\"19\\">19</option>";
echo "<option value=\\"20\\">20</option>";
echo "<option value=\\"21\\">21</option>";
echo "<option value=\\"22\\">22</option>";
echo "<option value=\\"23\\">23</option>";
echo "<option value=\\"24\\">24</option>";
echo "<option value=\\"25\\">25</option>";
echo "<option value=\\"26\\">26</option>";
echo "<option value=\\"27\\">27</option>";
echo "<option value=\\"28\\">28</option>";
echo "<option value=\\"29\\">29</option>";
echo "<option value=\\"30\\">30</option>";
echo "<option value=\\"31\\">31</option>";
echo "</select>";
echo ".";
echo "<select name=\\"måned\\">";
echo "<option value=\\"Måned\\">Måned</option>";
echo "<option value=\\"1\\">1</option>";
echo "<option value=\\"2\\">2</option>";
echo "<option value=\\"3\\">3</option>";
echo "<option value=\\"4\\">4</option>";
echo "<option value=\\"5\\">5</option>";
echo "<option value=\\"6\\">6</option>";
echo "<option value=\\"7\\">7</option>";
echo "<option value=\\"8\\">8</option>";
echo "<option value=\\"9\\">9</option>";
echo "<option value=\\"10\\">10</option>";
echo "<option value=\\"11\\">11</option>";
echo "<option value=\\"12\\">12</option>";
echo "</select>";
echo "-";
echo "<select name=\\"år\\">";
echo "<option value=\\"År\\">År</option>";
echo "<option value=\\"2005\\">2005</option>";
echo "<option value=\\"2006\\">2006</option>";
echo "</select>";
echo "";
echo "<textarea name=\\"forord\\" cols=\\"36\\" rows=\\"5\\">Skriv forord</textarea>";
echo "";
echo "<textarea name=\\"indhold\\" cols=\\"50\\" rows=\\"15\\" id=\\"indhold\\">Skriv indhold</textarea>";
echo "";
echo "<input type=\\"submit\\" name=\\"Add\\" value=\\"Tilføj\\">";
echo "</form>";
}
?>
</pre>
Anders!