开发者

Adding links to text from an html textarea

开发者 https://www.devze.com 2023-01-31 03:06 出处:网络
Is this possible? What I would like to do is designate certain text that the user writes in a text area as a link. This text is inserted into a MySQL database then pulled, and displayed elsewhere. Als

Is this possible? What I would like to do is designate certain text that the user writes in a text area as a link. This text is inserted into a MySQL database then pulled, and displayed elsewhere. Also the links will never really b开发者_JAVA技巧e in the same spot.


You could could use jQuery to grab the value of the textarea on change and use ajax to send it to a php page which logs it to a mysql db, then use jQuery setInterval/ajax combo to pull back results from the php/mysql to put elsewhere on your page :)

Also you can construct the link in the php then just send back html to your page


Can you describe this process a bit more? How will the specific text within the textarea be known to be a "link"? What will it link to? (Side note, be very careful with cross-site-scripting and such. A JavaScript command can be in a link.)

Why not use a rich text editor which allows the user to create links? Maybe something that supports markdown like this site does?

0

精彩评论

暂无评论...
验证码 换一张
取 消