473,382 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

inserting data via browser(textarea) into database

I just wanted to make something that creates html-code which should be
inserted in a mysql database.

The user should type text in a textarea. When the user submits the data,
all enters should be translated into "<br>" and it would be nice if the
user could also insert links ( "<a href="..." ) in the formular.

Does someone knows a good, very simple script? There are wysiwyg editors
on the net, but I don't need to modify fonts, colors et cetera. The most
important thing are the "<br>" tags which should be generated.
May 29 '06 #1
3 4722

Tommy DN wrote:
I just wanted to make something that creates html-code which should be
inserted in a mysql database.

The user should type text in a textarea. When the user submits the data,
all enters should be translated into "<br>" and it would be nice if the
user could also insert links ( "<a href="..." ) in the formular.

Does someone knows a good, very simple script? There are wysiwyg editors
on the net, but I don't need to modify fonts, colors et cetera. The most
important thing are the "<br>" tags which should be generated.


Concerning the breaks, you'd might wanna check out the built in php
function nl2br()
Found at http://php.net/nl2br
Turns (textfield) breaks into <br />.

Frizzle.

May 29 '06 #2
Tommy DN wrote:
I just wanted to make something that creates html-code which should be
inserted in a mysql database.

The user should type text in a textarea. When the user submits the data,
all enters should be translated into "<br>" and it would be nice if the
user could also insert links ( "<a href="..." ) in the formular.


new line to <br> is easily done with nl2br()
http://www.php.net/manual/en/function.nl2br.php

For urls you will most likely need to make your own function that uses regexp,
there are a number of functions you can use to transform a web-address into a
anchor.
http://www.php.net/manual-lookup.php...regexp&lang=en

//Aho
May 29 '06 #3
This should be able to handle converting urls to links...

function text_to_link_conversion($text) {
$text =
eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'\\1<a href="http://\\2">\\2</a>', $text);
$text =
eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'<a href="\\1">\\1</a>', $text);
return $text;
}

May 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Gadrin77 | last post by:
I noticed when displaying the contents of a CDATA node inside a TEXTAREA using MSXML and XSL, I get an extra space before the data. at first I thought I hadn't "tightened up" the XSL, but then...
2
by: Jake_adl | last post by:
Is there any way to create a Microsoft.Practices.EnterpriseLibrary.Data.Database object without reading from a configuration file? I am writing a utility that manages databases in SQL Server....
5
by: joelbyrd | last post by:
Didn't know exactly where to post this, but: How do I get line breaks in a textarea? I'm pulling text from a database, and this text definately has line breaks in it, because I replaced all the...
3
by: andrewtayloruk | last post by:
I'm a newbie when it come to things php and i'm having a bit of trouble. I'm trying to insert data from an html form into a mysql database and can't get it to work. Just a few bits about my...
8
sumaiya
by: sumaiya | last post by:
I have interactive flash website intelution.com It is getting data from a database using PHP file system print "&photo$i=http://www.intelution.com/$photo&prod$i=$prod&"; The thing is the...
14
by: veer | last post by:
Hello expert. I made a program in which the data from an SQL table is transferred to an Excel sheet. When the data type of a field is Integer it works fine, but when the data type of a field is...
1
by: cabbiepete | last post by:
In the thread http://www.thescripts.com/forum/thread11792.html this question was posed and while an answer was posted it wasn't explained at all why that worked. I thought I would post the answer in...
0
parshupooja
by: parshupooja | last post by:
Hey All, I am trying to create utility to check data inconsistency in ASP.net 2.0 C# means I want to compare two databases in two different sources i.e MS Access and SQL Server. I want to...
2
by: Ross | last post by:
When I sometimes want to debug something on a browser without a firebug console, I have been using a textarea to which I can print stuff. So my HTML calls my big script file, and further down in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.