css-man
دوشنبه 04 مهر 1390, 02:36 صبح
1- اطلاعات در دیتابیس از طریق فرم درج خبر ثبت نمیشه
2 - اما پیغام ارسال موفقیت آمیز صادر میشه
3- به صفحه ای که میخوام ریدایرکت نمیشه و بر میگرده به همین صفحه اینم کدش
<?php
include("config.php");
if(isset($_POST['submit']))
{//begin of if($submit).
//set global variables to easier name
$title=$_POST['title'];
$text1=$_POST['text1'];
$text2=$_POST['text2'];
//check if (title)field is e,pty then print error message.
if(!$title){//this means if the title is really empty.
echo "ERROR: news title is a required field .please fill it.";
exit();
}//end if
//run the query which adds the data gathered from the form into the database.
$result=mysql_query("INSERT INTO news(title,dtime,text1,text2)
VALUES('$title',NOW(),$text1,4text2)",$connect);
//print success message.
echo "<b>thank you!News added successfully!<br>You'll be redirected to home page after (4)seconds";
echo "<meta http-equiv=Refresh content=4; url= index.php>";
}//end of if ($submit).
//if the form has not been submitted ,Display it!
else
{//Begin of else
?>
<br>
<h3>:add news</h3>
<br>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
Title:<input name="title" size="40" maxlength="255">
<br>
<br>
Text1:<textarea name="text1" rows="7" cols="30"></textarea>
<br>
Text2:<textarea name="text2" rows="7" cols="30"></textarea>
<br />
<input type="submit" name="submit" value="Add News" />
</form>
<?php
}//end of else
?>
این هم صفحه اخباره که پیغام میده تگ پی اچ پی رو نبستم ولی هرچی نگاه میکنم میبینم که بستمش
Parse error: syntax error, unexpected $end in C:\wamp\www\19\news.php on line 112
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="innerstyle.css" type="text/css" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {color: #990000}
.style2 {color: #993300}
-->
</style>
</head>
<body>
<!-----------start wraper------------->
<div id="wraper">
<?php
//load the configuration file.
include("config.php");
?>
<!------------start menu------------->
<div id="menu">
menu
</div>
<!-------------end menu--------------->
<!-------------start body------------>
<div id="body">
<!------------start slide----------->
<div id="slide"><img src="img/titlep.jpg" /></div>
<!----------end slide-------------->
<!----------start news------------->
<div id="news">
<!------start newsr---------------->
<div id="newsr">
<?php
//load all news from the data base and then ORDER them by newsid
//You will notice thate newlly added news will appeare first.
//also You can ORDER by (dtime)instaed of (newsid)
$result=mysql_query("SELECT * FROM news ORDER BY newsid DESC",$connect);
//lets make a loop and get all news from the database
while($myrow=mysql_fetch_assoc($result))
{//begin of loop
//now print the result
//-----------start newsd------------>
echo "<div id='newsd'>";
//---start date & time--->
echo "<div id='date'>";
echo $myrow['dtime'];
echo "</div>";
//---end date & time--->
//---start title--->
echo "<div id='title'>";
echo $myrow['title'];
echo " </div>";
//-----end title----->
echo "<p>";
echo $myrow['text1'];
echo "</p>";
echo "<p> </p>";
echo "<div id='readmore'><a href=\read_more.php?newsid=$myrow[newsid]\">ادامه مطلب</a>";
echo "</div>";
//-------------end readmor--->
?>
</div>
<!-----------end newsd------------>
<!-----start read mor---->
<!--------------------start part---------><!--------------------end part---------></div>
<!-------end newsr---------------->
<!-------start right-------------->
<div id="right">
<!----------start search---------------><!--------------------end search---------------------->
<!-------------------start archive-------------------->
<div id="archiv">
<div id="titr">
<p>بازدید کنندگان شما پائین است؟ </p>
</div>
<div id="icon">
<img src="img/1seo.gif" />
</div>
<div id="nr">
<p>بدون شک بهترین راه برای بالا بردن </p>
<p>بازدید کنندگان سایت شما سئو ....</p>
</div>
<div id="more2">ادامه مطلب</div>
</div>
<!----------------------end archiv-------------------->
</div>
<!----------end right------------->
</div>
<!--------end news---------------->
<!-------------end body-------------->
<!---------------start footer--------->
<div id="footer">
</div>
<!--------------snd footer------------>
</div>
<!-----------end wraper--------------->
</body>
</html>
2 - اما پیغام ارسال موفقیت آمیز صادر میشه
3- به صفحه ای که میخوام ریدایرکت نمیشه و بر میگرده به همین صفحه اینم کدش
<?php
include("config.php");
if(isset($_POST['submit']))
{//begin of if($submit).
//set global variables to easier name
$title=$_POST['title'];
$text1=$_POST['text1'];
$text2=$_POST['text2'];
//check if (title)field is e,pty then print error message.
if(!$title){//this means if the title is really empty.
echo "ERROR: news title is a required field .please fill it.";
exit();
}//end if
//run the query which adds the data gathered from the form into the database.
$result=mysql_query("INSERT INTO news(title,dtime,text1,text2)
VALUES('$title',NOW(),$text1,4text2)",$connect);
//print success message.
echo "<b>thank you!News added successfully!<br>You'll be redirected to home page after (4)seconds";
echo "<meta http-equiv=Refresh content=4; url= index.php>";
}//end of if ($submit).
//if the form has not been submitted ,Display it!
else
{//Begin of else
?>
<br>
<h3>:add news</h3>
<br>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
Title:<input name="title" size="40" maxlength="255">
<br>
<br>
Text1:<textarea name="text1" rows="7" cols="30"></textarea>
<br>
Text2:<textarea name="text2" rows="7" cols="30"></textarea>
<br />
<input type="submit" name="submit" value="Add News" />
</form>
<?php
}//end of else
?>
این هم صفحه اخباره که پیغام میده تگ پی اچ پی رو نبستم ولی هرچی نگاه میکنم میبینم که بستمش
Parse error: syntax error, unexpected $end in C:\wamp\www\19\news.php on line 112
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="innerstyle.css" type="text/css" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {color: #990000}
.style2 {color: #993300}
-->
</style>
</head>
<body>
<!-----------start wraper------------->
<div id="wraper">
<?php
//load the configuration file.
include("config.php");
?>
<!------------start menu------------->
<div id="menu">
menu
</div>
<!-------------end menu--------------->
<!-------------start body------------>
<div id="body">
<!------------start slide----------->
<div id="slide"><img src="img/titlep.jpg" /></div>
<!----------end slide-------------->
<!----------start news------------->
<div id="news">
<!------start newsr---------------->
<div id="newsr">
<?php
//load all news from the data base and then ORDER them by newsid
//You will notice thate newlly added news will appeare first.
//also You can ORDER by (dtime)instaed of (newsid)
$result=mysql_query("SELECT * FROM news ORDER BY newsid DESC",$connect);
//lets make a loop and get all news from the database
while($myrow=mysql_fetch_assoc($result))
{//begin of loop
//now print the result
//-----------start newsd------------>
echo "<div id='newsd'>";
//---start date & time--->
echo "<div id='date'>";
echo $myrow['dtime'];
echo "</div>";
//---end date & time--->
//---start title--->
echo "<div id='title'>";
echo $myrow['title'];
echo " </div>";
//-----end title----->
echo "<p>";
echo $myrow['text1'];
echo "</p>";
echo "<p> </p>";
echo "<div id='readmore'><a href=\read_more.php?newsid=$myrow[newsid]\">ادامه مطلب</a>";
echo "</div>";
//-------------end readmor--->
?>
</div>
<!-----------end newsd------------>
<!-----start read mor---->
<!--------------------start part---------><!--------------------end part---------></div>
<!-------end newsr---------------->
<!-------start right-------------->
<div id="right">
<!----------start search---------------><!--------------------end search---------------------->
<!-------------------start archive-------------------->
<div id="archiv">
<div id="titr">
<p>بازدید کنندگان شما پائین است؟ </p>
</div>
<div id="icon">
<img src="img/1seo.gif" />
</div>
<div id="nr">
<p>بدون شک بهترین راه برای بالا بردن </p>
<p>بازدید کنندگان سایت شما سئو ....</p>
</div>
<div id="more2">ادامه مطلب</div>
</div>
<!----------------------end archiv-------------------->
</div>
<!----------end right------------->
</div>
<!--------end news---------------->
<!-------------end body-------------->
<!---------------start footer--------->
<div id="footer">
</div>
<!--------------snd footer------------>
</div>
<!-----------end wraper--------------->
</body>
</html>