I know that this forum is for HTML and CSS, but I have a problem and I am not sure where to take it, so here it is.
I am using this code:

<div class="edit">
        <input type="button" id="bold" style="height:21px; width:21px; font-weight:bold;" value="B" onClick="fontEdit('bold')" />
        <input type="button" id="italic" style="height:21px; width:21px; font-style:italic;" value="I" onClick="fontEdit('italic')" />
        <input type="button" id="underline" style="height:21px; width:21px; text-decoration:underline;" value="U" onClick="fontEdit('underline')" /> | 
        <input type="button" style="height:21px; width:21px;"value="L" onClick="fontEdit('justifyleft')" title="align left" />
        <input type="button" style="height:21px; width:21px;"value="C" onClick="fontEdit('justifycenter')" title="center" />
        <input type="button" style="height:21px; width:21px;"value="R" onClick="fontEdit('justifyright')" title="align right" /> | 

        <input type="button" style="height:21px; width:21px;"value="1" onClick="fontEdit('insertorderedlist')" title="Numbered List" />
        <input type="button" style="height:21px; width:21px;"value="●" onClick="fontEdit('insertunorderedlist')" title="Bullets List" />
    </div>

    <iframe id="textEditor" style="width:690px; height:275px;">
    </iframe>


    <script type="text/javascript">
    <!--
    textEditor.document.designMode="on";
    textEditor.document.open();
    textEditor.document.write('<head><style type="text/css">body{ font-family:arial; font-size:12px;}</style></head>');
    textEditor.document.close();

    function def()
    {
       document.getElementById("fonts").selectedIndex=0;
       document.getElementById("size").selectedIndex=1;
       document.getElementById("color").selectedIndex=0;
    }

    function fontEdit(x,y)
    {
        textEditor.document.execCommand(x,"",y);
        textEditor.focus();
    }
    -->
</script></td>

to create a rich text editor on my web page, however I am not sure how to take the information that is entered into the editor and store it in the table that I have created on my server, I have the buttons made for the submition and the code for the insertion created in PHP, however I am stuck on how to pass the information to the PHP code in order to insert it into the table. Can anyone help?

Recommended Answers

All 10 Replies

yes the div refers to a class I have created in a .css file, however that is just for making the buttons apear the way I want them to, if you need it I can post the class info as well.

Member Avatar for LastMitch

@GraficRegret

yes the div refers to a class I have created in a .css file, however that is just for making the buttons apear the way I want them to, if you need it I can post the class info as well.

May I ask you this question what is the textEditor product?

however I am stuck on how to pass the information to the PHP code in order to insert it into the table.

You can just used AJAX without a database. Since you are using javascript.

I need the information to go into my database so I can call it for the front end of my web page and so it can be edited and changed later as well, and the text editor is just the field that is typed in.

Member Avatar for LastMitch

@GraficRegret

I need the information to go into my database so I can call it for the front end of my web page and so it can be edited and changed later as well, and the text editor is just the field that is typed in.

This is just a basic query to fetch the data from the database.

right, I have that part done I am trying to figure out how to pass the information typed into the text field into the PHP code that I have set up to insert the data into the table so that I can extract it later.

Member Avatar for LastMitch

right, I have that part done I am trying to figure out how to pass the information typed into the text field into the PHP code that I have set up to insert the data into the table so that I can extract it later.

What text editor are you using?

I created it myself using a tutorial to assist

To take data entered on a web page and put it in a database, you use a form and give the form and action - tell it to run a script when the submit button is clicked.

The script then takes the data, connects to the database and runs an sql query which inserts the data into a table in the database, and into the appropriate fields in that table.

You currently don't have a form, a submit button, an action or a script for us to look at..

The form should probably be in your iframe, with a textarea input field, named and ided, and the script uses that to know what data it has to handle.

Yeah I thought that to but when I added the form script to the iframe it chanved and distorted both boxes. I will post the other scripts on Monday when I have access to them.

ok so it would seem that noone has any answers then?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.