So jetzt die Seite, wo ich zuerst die nachricht auswähle nachrichtbearbeiten.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?PHP include "../tr/siteheader.php"; ?>
</head>
<body>
<div id="holepage">
<div id="header">
<?PHP include "../tr/header.php"; ?>
</div>
<div id="nav">
<?PHP include "../tr/links.php"; ?>
</div>
<div id="content">
<div class="style_1">Nachricht bearbeiten</div>
<div class="style_2">
<table align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#CCCCCC">
<td width="80px" height="20px" align="center" valign="middle">Archiv - Nr.</td>
<td width="50px" height="20px" align="center" valign="middle"> </td>
<td width="620px" height="20px" align="left" valign="middle">Überschrift</td>
</tr>
</table>
<?PHP
$start = (isset($_GET['start'])) ? abs((int)$_GET['start']) : 0;
$limit = 25;
$resultID = @mysql_query("SELECT COUNT(nr) FROM `haber`");
$total = @mysql_result($resultID,0);
$sql1 = "SELECT `baslik`, `haberarsivno` FROM `haber` ORDER BY `nr` DESC LIMIT ".$start.",".$limit;
$result1 = mysql_query($sql1);
echo"
<table width=\"750px\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td colspan=\"3\"> </td>
</tr>
<tr>
<td width=\"350\" align=\"right\">
";
if ($start > 0)
{
$newStart = ($start - $limit < 0) ? 0 : ($start-$limit);
echo " <a href=\"".$PHP_SELF."?start=".$newStart."\"> <img src=\"../zuruck.jpg\" alt=\"\" border=\"0\" /> </a> ";
}
echo " </td><td width=\"50\"> </td><td width=\"350\" align=\"left\">";
if ($start + $limit < $total)
{
$newStart = $start + $limit;
echo " <a href=\"".$PHP_SELF."?start=".$newStart."\"> <img src=\"../vor.jpg\" alt=\"\" border=\"0\" /> </a>";
}
echo " </td></tr></table>";
echo"<table width=\"750px\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\">";
while($row1 = mysql_fetch_object($result1))
{
echo"
<tr>
<td width=\"80px\" height=\"20px\" align=\"center\" valign=\"middle\">$row1->haberarsivno</td>
<td width=\"50px\" height=\"20px\" align=\"center\" valign=\"middle\"> </td>
<td width=\"620px\" height=\"20px\" align=\"left\" valign=\"middle\"><a href=\"nachrichtandern.php?nachrichtnr=$row1->haberarsivno\">$row1->baslik</a></td>
</tr>
";
}
echo "</table>";
?>
</div>
</div>
</div>
</body>
</html>
Jetzt, die php datei wo ich die nachricht ändere: nachrichtandern.php und skript2.php
<?PHP
$sql1 = "SELECT * FROM `haber` WHERE haberarsivno='".$_GET['nachrichtnr']."'";
$result1 = mysql_query($sql1);
while($row1 = mysql_fetch_object($result1))
{
$number=$row1->nr;
$date=$row1->tarih;
$headline=$row1->baslik;
$bild1=$row1->IMG1;
$news=$row1->haber;
$nnews=strip_tags($news);
$anumber=$row1->haberarsivno;
$bild2=$row1->IMG2;
$bild3=$row1->IMG3;
$bild4=$row1->IMG4;
$bild5=$row1->IMG5;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?PHP include "../tr/siteheader.php"; ?>
</head>
<body>
<form action="skript2.php" method="post" enctype="multipart/form-data">
<div id="holepage">
<div id="header">
<?PHP include "../tr/header.php"; ?>
</div>
<div id="nav">
<?PHP include "../tr/links.php"; ?>
</div>
<div id="content">
<div class="style_1">Nachricht bearbeiten</div>
<div class="style_2">
<table align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="160px" height="24px" align="left" valign="middle">Nachrichten - Nummer:</td>
<td height="24px" align="left" valign="middle"><input type="text" name="nachrichtennummer" class="style_3" readonly="readonly" value="<?PHP echo"$number"; ?>" /></td>
</tr>
<tr>
<td width="160px" height="24px" align="left" valign="middle">Datum:</td>
<td height="24px" align="left" valign="middle"><input type="text" name="datum" class="style_4" value="<?PHP echo"$date"; ?>" /></td>
</tr>
<tr>
<td width="160px" height="24px" align="left" valign="middle">Überschrift:</td>
<td height="24px" align="left" valign="middle"><input type="text" name="ueberschrift" class="style_4" value="<?PHP echo"$headline"; ?>" /></td>
</tr>
<tr>
<td width="160px" height="24px" align="left" valign="top">Nachricht:</td>
<td height="24px" align="left" valign="middle"><textarea name="nachricht" class="style_6" cols="" rows=""><?PHP echo"$nnews"; ?></textarea></td>
</tr>
<tr>
<td width="160px" height="24px" align="left" valign="middle">Archiv - Nummer:</td>
<td height="24px" align="left" valign="middle"><input type="text" name="archivnummer" class="style_3" readonly="readonly" value="<?PHP echo"$anumber"; ?>" /></td>
</tr>
<tr>
<td colspan="2" height="24px" align="center" valign="middle"> </td>
</tr>
<tr>
<td colspan="2" height="24px" align="center" valign="middle"> </td>
</tr>
<tr>
<td colspan="2" height="24px" align="center" valign="middle"> </td>
</tr>
<tr>
<td colspan="2" height="24px" align="center" valign="middle"> </td>
</tr>
<tr>
<td colspan="2" height="24px" align="center" valign="middle"> </td>
</tr>
<tr>
<td colspan="2" height="24px" align="center" valign="middle"><input type="submit" class="style_7" value="Abschicken"/></td>
</tr>
</table>
</div>
</div>
</div>
</form>
</body>
</html>
skript2.php:
<?PHP
//UEBERSCHRIFT (SONDERZEICHEN)
$nhead1 = ereg_replace("'","'",$_POST['ueberschrift']);
$nhead1 = ereg_replace("\"",""",$_POST['ueberschrift']);
// NACHRICHT (SONDERZEICHEN)
$nnews1 = nl2br($_POST['nachricht']);
// DATUM
$date = mysql_real_escape_string($_POST['datum']);
// UEBERSCHRIFT
$headline = $nhead1;
// KURZE NACHRICHTENBESCHREIBUNG
$smalltext = substr($_POST['nachricht'], 0, 180);
// NACHRICHT
$news = $nnews1;
// ARCHIVNUMMER
$archivenummber = mysql_real_escape_string($_POST['archivnummer']);
// NACHRICHT EINFUEGEN
mysql_query(
"UPDATE `haber` SET
tarih = '$date',
baslik = '$headline',
betimleme = '$smalltext ...',
haber = '$news',
haberarsivno ='$archivenummber' WHERE `haberarsivno` = '$_POST[archivnummer]'"
);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?PHP include "../tr/siteheader.php"; ?>
</head>
<body>
<form action="skript1.php" method="post" enctype="multipart/form-data">
<div id="holepage">
<div id="header">
<?PHP include "../tr/header.php"; ?>
</div>
<div id="nav">
<?PHP include "../tr/links.php"; ?>
</div>
<div id="content">
<div class="style_1">Nachricht bearbeiten</div>
<div class="style_2" style="margin-top:6px;" align="center">
<table align="center" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" align="center" style="color:green">Nachricht ERFOLGREICH übermittelt</td>
</tr>
</table>
</div>
</div>
</div>
</form>
</body>
</html>
Die ganzen Verbindungen zur Datenbank habe ich raus genommen. Wie gesagt, beim insert alles tutti, beim updatet klappt nichts.
und hier die stelle aus dem header.php wo ff und ie rummäckert:
document.getElementById("betim").innerHTML = '<?PHP echo "<a href=\"haberler.php?haberarsivno=$hn1\">$betim1</a>"; ?>';
Gruß Timur