Re: Textarea update problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



replies-lists-a1z2-php@xxxxxxxxxxxxxxxxxxxxx wrote:
is there a question here, or are you asking us to write the script for
you?
  - Rick


------------ Original Message ------------
Date: Wednesday, March 07, 2007 01:54:04 PM +0100
From: Delta Storm <delta.storm@xxxxxxxxxxx>
To: php-general@xxxxxxxxxxxxx
Subject:  Textarea update problem

Hi,

I'd like to thank everybody who have helped me till now. All your
advices were very helpfull... :)

But I have a problem again

I need to build a script which will have have the following functions:

1.Be able to select 3 columns from a MySQL database(idnetify the
columns by ID) and put the column contents into 3 textarea objects.
(for example title,Text1,Text2 each into i textarea).

2.Edit and MySQL update the textarea contents


And all in one script.

The script has a $id = $_GET['id'] variable which holds the
information about the certain table id.


---------- End Original Message ----------



This is the script, I have dealt with both problems but when I click on
the update button (submit button) i get an error msg:


 Access forbidden!

You don't have permission to access the requested object. It is either
read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster
<mailto:admin@localhost>.


   Error 403

localhost </>
03/07/07 16:17:37
Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d
mod_autoindex_color PHP/5.2.0


The user name and pass for the MySQL server are 100% correct.

It reads out the data from the database into the textarea object but
when I click the update button I get that msg.

Thank you! :)



<!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"; lang="hr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="hr">
<title>UPDATE news and article items</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>


<?php

   $id = $_GET['id'];
   include("authenticate.php");
   $link = mysql_connect("localhost","$admin","$pass") or die ("Could
not connect to database");

   mysql_select_db("europe") or die ("Could not select database");

   mysql_query("set names utf8");
   $selResult = mysql_query("select title,sText,fText from news where
id='$id'");

   if (mysql_num_rows($selResult) > 0)
   {
       while ($row = mysql_fetch_array($selResult))
       {
           if (!$_POST["submit"])
           {
           echo '<table border="0" cellspacing="0" cellpadding="0"
align="center">';
               echo "<tr>";
                   echo '<td colspan="2">';
                       echo "<form action='<?php echo
$_SERVER[PHP_SELF] ?>' method=post>";
                       echo "<input type=text size=180 name=title
value=" . $row['title'] .">";
                   echo "</td>";
               echo "</tr>";
               echo "<tr>";
                   echo "<td>";
                       echo "<h2>sText</h2>";
                       echo '<textarea cols="65" rows="30" name="sText">';
                       echo $row['sText'];
                       echo "</textarea>";
                   echo '</td>
                   <td>
                       <h2>fText</h2>
                       <textarea cols="65" rows="30" name="fText" >';
                       echo $row['fText'];
                       echo '</textarea>
                   </td>
               </tr>
               <tr>
                   <td colspan="2" align="center">
                       <input type="submit" value="UPDATE" name="submit">
                       </form>
                   </td>
               </tr>
       </table>';
           }
           else
           {
               $title = ($_POST['title']);
               $sText = ($_POST['sText']);
               $fText = ($_POST['fText']);

               $query = "update news set title='$title',
sText='$sText', fText='$fText' where id='$id'";

               $result = mysql_query($query) or die ("could not process
query : $query" . mysql_error());

               if ($result)
               {
                   echo "Data updated succesfully";
                   echo '<a href="edititems.php">Povratak na
editiranje</a>';
               }
               else
               {
                   echo "Data update FAILED";
               }
               mysql_close($link);
           }
       }
   }

?>
</body>
</html>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux