Jump to content

Php Kodunda Ne Hatası Var


Recommended Posts

İyi günler ben php ile blog sitesi yapmaya ugrasıyorum ama bir türlü şu kod ile dataya yazı yazdıramıyorum cok ugrastım ama bir türlü yapamadım
[spoiler]
<?php
function index (){
?>
<div class="post">

<a name="TemplateInfo"></a>
<h1>YÖNETİM PANELİ</h1>
<ul>
<li>
<a href="?Act=ekle">İçerik ekle </a><br />
<li><a href="?Act=Ekle">Kayıtlı İçerikler </a><br />
<li><a href="#">İçerik sil </a><br />
<li><a href="?Act=Ekle">İçerik ekle </a><br />
</li>
</li>
</li>
</li>
</ul>
</div>
<br />
<?php
}
function ekle (){
$baslik =$_POST["baslik"];
$icerik =$_POST["icerik"];
if ((isset ($_POST["eklebutton"]))){
if (empty($baslik)or empty($icerik)) {
echo "boş alan bırakma";
}else{
$sql112 = mysql_query ("INSERT INTO articles ('title','articles') VALUES ('$baslik','$icerik')");
if ($sql112) {
echo "İcerik Eklendi";
}else{
echo"Hata İiçerik Eklenmedi!!";
}
}
}

?>
<h3>İçerik Ekle</h3>
<form action="?Act=ekle" method="post">
<p>
<label>Başlık</label>
<input name="dname" type="text" value="Başlık" size="30" maxlength="250" />
<label>İçerik</label>
<textarea rows="5" cols="5"></textarea>
<br />
<input name="eklebutton" type="submit" class="button " />
</p>
</form>
<?php
}
?>
<?php
$Act=$_GET['Act'];
switch ($Act){
default :
index ();
break;
case "ekle":
ekle ();
break;
}
?>[/spoiler] Edited by ScroLLLock
Link to comment
Share on other sites

[code]$sql112 = mysql_query ("INSERT INTO articles ('title','articles') VALUES ('$baslik','$icerik')"); [/code]

şurayı aşağıdakiyle değiştir.

[code]$sql112 = mysql_query ("INSERT INTO articles (title,articles) VALUES ('$baslik','$icerik')"); [/code]

Link to comment
Share on other sites

[code]<textarea rows="5" cols="5"></textarea>[/code]

şunuda aşağıdakiyle değiştir. bide sana tavsiyem copy-paste yapma. kendin yazmaya çalış.

[code]<textarea rows="5" cols="5" name="icerik"></textarea>[/code]

Link to comment
Share on other sites

Gine aynı veriyi işlemiyor boş alan bırakma diyor script aşagıda hepsini verdim
[spoiler]
<?php
session_start();
include "ayarlar.php";
$admingirdi=$_SESSION['admin'];

if(empty($admingirdi)){
header ("location:login.php");
die();
}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="tr" lang="tr">

<head>

<meta name="Description" content="Information architecture, Web Design, Web Standards." />
<meta name="Keywords" content="your, keywords" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254" />
<meta name="Distribution" content="Global" />
<meta name="Robots" content="index,follow" />

<link rel="stylesheet" href="images/PixelGreen.css" type="text/css" />

<title><?php echo $site_title;?></title>

</head>

<body>
<!-- wrap starts here -->
<div id="wrap">

<div id="header"><div id="header-content">

<h1 id="logo"><a href="index.php" title=""><?php echo $site_logo;?></a></h1>
<h2 id="slogan"><?Php echo $site_slogan;?></h2>

<!-- Menu Tabs -->
<ul>
<li><a href="yonetim.php" id="current">ANASAYFA</a></li>
<li><a href="index.php">Dosyalar</a></li>
<li><a href="index.php">İletişim</a></li>
<li><a href="cikis.php">Çıkış</a></li>

</ul>


</div></div>

<div class="headerphoto"></div>

<!-- content-wrap starts here -->
<div id="content-wrap"><div id="content">

<div id="sidebar" >

<div class="sidebox">

<h1>Admin Paneli</h1>

<p></p>

</div>

<div class="sidebox">

<h1 class="clear">Güncel Konular </h1>
<ul class="sidemenu">
<?php
$sql=" Select *From articles order by id desc LIST 0,5";
$query =mysql_query($sql);
while ($read = mysql_fetch_assoc($query)){
$id =$read ['id'];
$title =$read ['title'];
echo "<li><a href='index.php?id=$id'>Teamle İnfo</a></li>";
}
?>
</ul>

</div>

<div class="sidebox">

<h1>Popüler Konular </h1>
<ul class="sidemenu">
<?php
$sql=" Select *From articles order by hit desc LIMIT 0,5";
$query =mysql_query($slq);
while ($read = mysql_fetch_assoc($query)){
$id =$read ['id'];
$title =$read ['title'];
echo "<li><a href='index.php?id=$id'>Teamle İnfo</a></li>";
}
?>
</ul>

</div>

<div class="sidebox">

<h1>Günün Sözü </h1>
<p> duyurular gelcek</p>
</div>

<div class="sidebox">

<h1>Hakkımızda</h1>
<p><?php echo $site_info;?></p>

</div>

<div class="sidebox">

<h1>Search Box</h1>
<form action="#" class="searchform">
<p>
<input name="search_query" class="textbox" type="text" />
<input name="search" class="button" value="Search" type="submit" />
</p>
</form>

</div>

</div>

<div id="main">
<?php
function index (){
?>
<div class="post">

<a name="TemplateInfo"></a>
<h1>YÖNETİM PANELİ</h1>
<ul>
<li>
<a href="?Act=ekle">İçerik ekle </a><br />
<li><a href="?Act=Ekle">Kayıtlı İçerikler </a><br />
<li><a href="#">İçerik sil </a><br />
<li><a href="?Act=Ekle">İçerik ekle </a><br />
</li>
</li>
</li>
</li>
</ul>
</div>
<br />
<?php
}
function ekle (){
$baslik =$_POST["baslik"];
$icerik =$_POST["icerik"];
if ((isset ($_POST["eklebutton"]))){
if (empty($baslik)or empty($icerik)) {
echo "boş alan bırakma";
}else{
$sql112 = mysql_query ("INSERT INTO articles (title,articles) VALUES ('$baslik','$icerik')");
if ($sql112) {
echo "İcerik Eklendi";
}else{
echo"Hata İiçerik Eklenmedi!!";
}
}
}

?>
<h3>İçerik Ekle</h3>
<form action="?Act=ekle" method="post">
<p>
<label>Başlık</label>
<input name="dname" type="text" value="Başlık" size="30" maxlength="250" />
<label>İçerik</label>
<textarea rows="5" cols="5" name="icerik"></textarea>
<br />
<input name="eklebutton" type="submit" class="button " />
</p>
</form>
<?php
}
?>
<?php
$Act=$_GET['Act'];
switch ($Act){
default :
index ();
break;
case "ekle":
ekle ();
break;
}
?>
</div> <!---- main bitiş --->

<!-- content-wrap ends here -->
</div></div>

<!-- footer starts here -->
<div id="footer"><div id="footer-content">

<div class="col float-left">
<h1>Site Partners</h1>
<ul>
<li><a href="http://www.dreamhost.com/r.cgi?287326"><strong>Dreamhost</strong> - Affordable &amp; Reliable Webhosting</a></li>
<li><a href="http://www.4templates.com/?aff=ealigam"><strong>4templates</strong> - Low Cost Hi-Quality Templates</a></li>
<li><a href="http://store.templatemonster.com/?aff=ealigam"><strong>TemplateMonster</strong> - Best templates on the net!</a></li>
<li><a href="http://www.fotolia.com/partner/114283"><strong>Fotolia</strong> - Free stock images or from $1</a></li>
<li><a href="http://www.text-link-ads.com/?ref=40025"><strong>Text Link Ads</strong> - Easiest. Money. Ever.</a></li>
</ul>
</div>

<div class="col float-left">
<h1>Links</h1>
<ul>
<li><a href="http://www.openwebdesign.org/">openwebdesign.org</a></li>
<li><a href="http://www.opendesigns.org/">Opendesigns.org</a></li>
<li><a href="http://www.pdphoto.org/">PDPhoto.org</a></li>
<li><a href="http://www.alistapart.com">Alistapart</a></li>
<li><a href="http://www.cssremix.com">CSS Remix</a></li>
</ul>
</div>

<div class="col2 float-right">
<p>
&copy; copyright 2006 <strong><?php echo $site_surum ?>e</strong><br />
Design by: <a href="index.php"><strong>styleshout</strong></a> &nbsp; &nbsp;
Valid <a href="http://jigsaw.w3.org/css-validator/check/referer"><strong>CSS</strong></a> |
<a href="http://validator.w3.org/check/referer"><strong>XHTML</strong></a>
</p>

<ul>
<li><a href="index.html"><strong>Home</strong></a></li>
<li><a href="index.html"><strong>Sitemap</strong></a></li>
<li><a href="index.html"><strong>RSS Feed</strong></a></li>
</ul>
</div>

</div></div>
<!-- footer ends here -->

<!-- wrap ends here -->
</div>

</body>
</html>
[/spoiler]

Link to comment
Share on other sites

[color="#FF0000"]<input name="dname" type="text" value="Başlık" size="30" maxlength="250" />[/color] burada name="dname" demişsin.

Ama formdan gelen değişkenleri tanımlarken [color="#FF0000"] $baslik =$_POST["baslik"]; [/color] kullanmışsın.

[color="#FF0000"]<input name="baslik" type="text" value="Başlık" size="30" maxlength="250" />[/color] yapman lazım.

Ayrıca articles diye bir tablo yapmışsın. Sütunlara da title ve articles demişsin. Sütunlara title yerine baslik , articles yerine icerik desen kodlama yaparken senin için kolaylık olur.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...