הכנתי 3 דפים פשוטים..
1 טופס שליחה
2 טופס שמכניס את המידע למסד
3 טופס שמוציא את המידע מהמס לדף
עכשיו הבעיה שלי הוא לא מציג לי את המידע הנה :
זה הדף index טופס שליחה
PHP קוד:
<html dir=rtl>
<head>
<title>הוספת חדשות</title>
</head>
<body>
<form action="add.php" method="post">
<b><font size="2" face="Arial">כתבה: <br> </font></b><font face="Arial">
<input name="subject" size="31" style="font-weight: 700"></font><b><font size="2" face="Arial">
<br>
תוכן: <br> </font></b><font face="Arial">
<textarea rows="9" cols="25" name="content" style="font-weight: 700"></textarea></font><b><font size="2" face="Arial">
<br>
</font></b><font face="Arial">
<input type="submit" name="submit" value="שלח!" style="font-weight: 700"></font><b><font size="2" face="Arial">
</font></b>
</form>
</body>
</html>
זה הקובץ שמכניס את המידע למסד add
PHP קוד:
<?php
if (!isset($_POST['submit'])) // אם לא נשלח הטופס אז..
{
header("location: index.php");
}
else
{
// הצבת משתנים
$koteret = $_POST['koteret'];
$tohen = $_POST['tohen'];
//התחברות לבסיס נתונים
mysql_connect('localhost','logicserv_zahi','salio') or die("ERROR: ".mysql_error());
mysql_select_db('logicserv_zahi') or die("ERROR: ".mysql_error()); // החלף את שם בסיס הנתונים בשם שקבעת
//הכנסת נתונים
mysql_query("INSERT INTO `programs`(`koteret`,`tohen`) VALUES('$koteret','$tohen')") or die("ERROR: ".mysql_error());
echo("הכתבה נוספה בהצלחה לבסיס הנתונים");
}
?>
זה הקובץ שפולט את המידע מהמסד לדף show.php
PHP קוד:
<?php
$host="localhost";
$user="logicserv_zahi";
$password="salio";
$db="logicserv_zahi";
mysql_connect($host,$user,$password);
mysql_select_db($db);
$theresult=mysql_query("SELECT * FROM `programs`") or die(mysql_error());
?>
<html>
<body>
<table border="1" width="110%">
<tr>
<td align="center" width="557"><font face="Arial"><b>כותרת</b></font></td>
<td align="center"><font face="Arial"><b>תוכן </b></font></td>
</tr>
<?
while ($recordeset=mysql_fetch_assoc($theresult)) {
echo "<tr>";
echo "<td><center>".$recordeset['koteret']."</center></td>";
echo "<td><center>".$recordeset['tohen']."</center></td>";
echo "</tr>";
}
?>
</TABLE>
<font face="Arial"><b>
</b></font>
</body>
</html>
שימו לב אני שולח הודעה מפה
http://www.logic-serv.co.il/1/index.php
תראו איך הוא מציג..
http://www.logic-serv.co.il/1/show.php
תודה לעוזרים.. ואשמח לדעת אם סידרתם מה היית הבעיה תודה לכולם