Dave Moore
Jun 11 2005, 05:20 PM
Hi All,
I hope you can give me a few pointers on this issue.
I'd like visitors to my website to be able to enter text to be viewed on the
site - a bit like a bulletin board or forum. I can do this for regular text
easily by simply populating a 'TEXT' field within my MySQL database and
grabbing it back when rendering the site using PHP. However, I'd also like
visitors to be able to put in URL links or email items that can be clicked.
How would I go about doing this?.I've seen this sort of thing on forums
where words can be selected and a URL applied, but I have no idea how to do
this and how this information (ie. the link and the associated text) would
be stored in the database field(s).
Any ideas?. Are there any PHP examples available for this sort of thing?.
Thanks for any comments.
Regards,
Dave
J.O. Aho
Jun 11 2005, 05:54 PM
Dave Moore wrote:
QUOTE |
Hi All, I hope you can give me a few pointers on this issue.
I'd like visitors to my website to be able to enter text to be viewed on the site - a bit like a bulletin board or forum. I can do this for regular text easily by simply populating a 'TEXT' field within my MySQL database and grabbing it back when rendering the site using PHP. However, I'd also like visitors to be able to put in URL links or email items that can be clicked. How would I go about doing this?.I've seen this sort of thing on forums where words can be selected and a URL applied, but I have no idea how to do this and how this information (ie. the link and the associated text) would be stored in the database field(s). Any ideas?. Are there any PHP examples available for this sort of thing?.
|
IMHO the easiest way is to allow users to use HTML-tags, that way they can set
URLs.
I think there are quite a lot of examples around the net, you can even take a
look at the online manual
http://www.php.net/manual/en/function.mysql-connect.phphttp://www.php.net/manual/en/function.mysql-fetch-array.phphttp://www.php.net/manual/en/function.mysql-query.phpTo catch the sent data, you can use $_REQUEST['text-name'] to get the data
from the form.
//Aho
Adamski
Jun 12 2005, 12:46 AM
On Sat, 11 Jun 2005 20:54:33 +0200, J.O. Aho wrote:
QUOTE |
Dave Moore wrote: Hi All, I hope you can give me a few pointers on this issue.
I'd like visitors to my website to be able to enter text to be viewed on the site - a bit like a bulletin board or forum. I can do this for regular text easily by simply populating a 'TEXT' field within my MySQL database and grabbing it back when rendering the site using PHP. However, I'd also like visitors to be able to put in URL links or email items that can be clicked. How would I go about doing this?.I've seen this sort of thing on forums where words can be selected and a URL applied, but I have no idea how to do this and how this information (ie. the link and the associated text) would be stored in the database field(s). Any ideas?. Are there any PHP examples available for this sort of thing?.
IMHO the easiest way is to allow users to use HTML-tags, that way they can set URLs.
|
Easy, certainly - but could also give you a few problems. You'd need
to watch out for links to *images*. I've seen a fair few bulletin
boards that have been "compromised" by people pasting HTML links to
rather unsavoury pics (that display inline) ;-)
You'd need to devise a search & replace for all HTML tags (look for
the < and > entities) - but allow <a href ....
Adam.
Dave Moore
Jun 12 2005, 01:49 PM
Thanks Aho, but that's not what I'm trying to achieve.
"J.O. Aho" <[Email Removed]> wrote in message
news:[Email Removed]...
QUOTE |
Dave Moore wrote: Hi All, I hope you can give me a few pointers on this issue.
I'd like visitors to my website to be able to enter text to be viewed on the site - a bit like a bulletin board or forum. I can do this for regular text easily by simply populating a 'TEXT' field within my MySQL database and grabbing it back when rendering the site using PHP. However, I'd also like visitors to be able to put in URL links or email items that can be clicked. How would I go about doing this?.I've seen this sort of thing on forums where words can be selected and a URL applied, but I have no idea how to do this and how this information (ie. the link and the associated text) would be stored in the database field(s). Any ideas?. Are there any PHP examples available for this sort of thing?.
IMHO the easiest way is to allow users to use HTML-tags, that way they can set URLs.
I think there are quite a lot of examples around the net, you can even take a look at the online manual
http://www.php.net/manual/en/function.mysql-connect.php http://www.php.net/manual/en/function.mysql-fetch-array.php http://www.php.net/manual/en/function.mysql-query.php
To catch the sent data, you can use $_REQUEST['text-name'] to get the data from the form.
//Aho |
J.O. Aho
Jun 12 2005, 02:22 PM
Dave Moore wrote:
QUOTE |
Thanks Aho, but that's not what I'm trying to achieve.
|
So it's not that you have a page with a text filed where users can write
something and the submit and your php page take the text written and stores
it in a mysql database which later on can be displayed on another page?
//Aho
Dave Moore
Jun 12 2005, 08:11 PM
"J.O. Aho" <[Email Removed]> wrote in message
news:[Email Removed]...
QUOTE |
Dave Moore wrote: Thanks Aho, but that's not what I'm trying to achieve.
So it's not that you have a page with a text filed where users can write something and the submit and your php page take the text written and stores it in a mysql database which later on can be displayed on another page?
|
Well Yes and No. I can already do this using the functions you highlighted
in your previous post. What I'd like to do in addition is to allow the user
(some how) to include hypertext links in with their text such that when the
information is rendered, visitors can click on the links and navigate to
other pages. I assume that some sort of special form would be required to do
this and I'd like to see some example code.
Dave
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.