2

I have a file with a textarea (named "Resolution support") in which you can explain how to solve a problem. My problem is that a user would be able to add a picture for a better explaining. If he copy/paste or he has to click and drag or anything i don't care, he HAS TO be able to put a picture into the textarea. I wondered if another textbox that can do this would exist and what Type does the textbox has to be in PhpMyAdmin.

My textarea :

<textarea  name="Escalade" class="longInput" cols="80%" rows="19" wrap="hard">
</textarea>
Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
Hearner
  • 2,711
  • 3
  • 17
  • 34
  • Do you want the user to store the file in your server ? Or maybe just get the URL of the file stored in a website ? Also try to store paths to images or files into your database and not the images directly – Daniel May 11 '15 at 14:29
  • If you have a problem, you search the problem and you have a file explaining how to solve it. You know, a tutorial is more understandable with pictures. I want to be able to store text and pictures and if I click on the problem, i can see how to solve it. You know, like every good tutorials – Hearner May 12 '15 at 06:39
  • I understand that, but I'm asking if you are actually saving your images directly into your MySQL database (harder) or saving it on the server and saving the path to your file in your database, see this answer http://stackoverflow.com/a/10773088/4884034 – Daniel May 12 '15 at 07:15
  • I don't know which one is better but it doesn't matter. I can do both – Hearner May 12 '15 at 07:36

3 Answers3

1

Without some kind of JavaScript WYSIWYG library this is not possible as vanilla textarea only takes text (clue is in the name).

I assume that you are viewing the submissions in phpMyAdmin which is an interface onto a MySQL database. It is good for developing stuff but not so great as an admin user interface long term. What you are asking about are called transformations.

Here are some tutorials on storing images in a database:

Here are some lists of WYSIWYG editors:

Those phpMyAdmin transformations:

That is about as much help as can be offered to you without seeing the PHP code behind the form at the very least. Hope this helps.

Community
  • 1
  • 1
1

If someone is looking for an answer, I had asked my profesor and he answered that what I was looking for is a "Rich Text Editor". I'm using ckeditor with the plugin prgfilemanager. It allows me to insert pictures but I cannot copy/paste them which is pretty annoying...

You can try it here http://ckeditor.com/demo I hope it will help you if you have the same problem that I had :)

Hearner
  • 2,711
  • 3
  • 17
  • 34
1

While it is true that you cannot use a textarea, the answer is very simple. You can use a content editable div, grab the contents as html and write it to a databae using AJAX and PHP.

Just name a div like this:

<div class="my_article" contenteditable></div>

and pass the contents on the click of a button into a JS variable and then pass that into PHP using AJAX.

var content1 = $('.my_article').html();

If anyone needs further help please comment and I'll be happy to obligue.