Reply to Re: easy update

Your name:

Reply:


Posted by Robert Frost-Bridges on 07/14/05 16:59

l e o wrote:

> I have a section on the web site that I would like to allow somebody who
> doesn't know html to be able to update the content. I am using
> Dreamweaver and need something much simpler for a secretary type of
> person. Maybe something that can be updated right on the website (using
> perl, etc, I presume), something like blog would work but I need to be
> have some control to be able to integrate it to the website's design.
> Thanks.

On the site in my sig I use a bit of php and mysql to do something like
this. There are various admin pages for the site where a , non-tecchy,
friend of mine can update the content simply by typing in to a <textarea>
or <input> and clicking 'Send'.

For instance, the short main paragraphs on the home page are written out
from a mysql db thus:

<div class="content">
<?php
$result = mysql_query('SELECT * FROM mainnews', $link_id);
while($query_data = mysql_fetch_row($result)) {
echo"<h1>$query_data[0]</h1>";
echo"<p>$query_data[1]</p>";
}
?>
</div>

where mainnews is the table containing the data he has entered, the first
field being the headline and the second the text. The admin page is
something like:

<div class="admincontent">
<form method="post" action="add_news.php">
<p>Title: <input type="text" name="title"></p>
<p><textarea name="words" cols="40" rows="20"></textarea></p>
<p><input type="submit" value="Post" class="sendbutton"></p>
</form>
<?php
$query =
"UPDATE mainnews SET title = '$title'";
$result = mysql_query($query);
$query =
"UPDATE mainnews SET words = '$words'";
$result = mysql_query($query);
?>
</div>

It means I can drop the content exactly in to the site as I want it. I've
only ever taught myself enough php and mysql as I've needed to know to get
this done however so I can't exactly vouch for the code being the best and
I'm not denying I had some problems along the way getting to where I am now
but it all seems to run pretty smoothly these days and I thought maybe it
would give you something to think about

I would actually like to find a way for him to insert paragraphs/line
breaks, as each entry is currently just a single block of text, but I
suspect this will involve someting other than a <textarea> for input and
I've not really looked in to how this would be done yet. At the moment I
would have to recreate all the above again and add it to the page where I
wanted the new paragraph.

regards,
--
Robert
http://brightonfixedodds.net

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация