Hello all,

I have created a dabase with table news.
I need to add some news into the table via a form.
I created two files, the form and the action php file:
But I am still unable to add data into the table.
Look at my code:
###################addnewsform.php###################################
<html dir="rtl">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<meta http-equiv="Content-Language" content="ar-sa">
<title>Add news</title>
</head>

<body>
أدخل المعلومات ثم اضغط على أضف:
<br>
<form method="POST" action="addnews.php">

  <div align="center">
    <center>
    <table border=0 width=100% cellspacing=0 cellpadding=0>

       <tr>
        <td width=18% bgcolor=#CC99FF valign=top><u>عنوان الخبر:</u></td>
        <td width="82%" bgcolor="#CCCCFF"><textarea rows="2" name="title"
cols="40"></textarea></td>
      </tr>
      <tr>
        <td width="18%" bgcolor="#CC99FF" valign="top"><u>الخبر:</u></td>
        <td width="82%" bgcolor="#CCCCFF"><textarea rows="10"
name="news_body" cols="40"></textarea></td>
      </tr>
      <tr>
        <td width="18%" bgcolor="#CC99FF" valign="top"><u>عنوان
          التفاصيل:</u></td>
        <td width="82%" bgcolor="#CCCCFF"><input type="text" name="more_url"
size="40"></td>
      </tr>
      <tr>
        <td width="18%" bgcolor="#CC99FF" valign="top">&nbsp;</td>
        <td width="82%" bgcolor="#CCCCFF">
          <div align="center">
            <table border="0" width="80%" align="right" cellspacing="0"
cellpadding="0">
              <tr>
                <td width="50%"><input type="submit" value="أضف"
name="B1"></td>
                <td width="50%"><input type="reset" value="مسح"
name="s2"></td>
              </tr>
            </table>
          </div>
          &nbsp;</td>
      </tr>
    </table>
    </center>
  </div>
</form>
</body>
</html>
##########################adnews.php######################################
<?
$verbindung=@mysql_connect("localhost", "root", "secret");
$abfrage="INSERT maurimedia(title, news_body, more_url) VALUES ($title,
$news_body, $more_url)";
$ergebnis=mysql_db_query("maurimedia", $abfrage, $verbindung);


//*Ueberpruefung der Verbindung
if (!$verbindung) {echo "impossible de se connecter au db maurimedia";
 exit;
 }

//*Ueberpruefung, ob die Daten angekommen sind
if ($ergebnis){echo "News successfull added :)";}else {echo "no news added
:(";}

mysql_close($verbindung);
?>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to