Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8965679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:51:44+00:00 2026-06-15T16:51:44+00:00

developing a light weight CMS system where users are able to change text and

  • 0

developing a light weight CMS system where users are able to change text and add an image. Was hoping to use form.textarea, unfortunately textarea doesn’t allow HTML tags, at least not image tag. So I’ve changed the form input to div from textarea. My question is how can I easily pass the div contents to a PHP script as a POST variable, similar to how the textarea would work.

Here are some code snippets:
In the HTML head, using this JQuery to append the image code when to the div content when an image icon (imgBtn) is clicked.

 <script language="javascript" type="text/javascript">
   $("#imgBtn").live("click",function(){
     var path = "path/to/file.jpg";
     var imgcode = '<img src="' + path + '" alt="User Image">';
 $('.textarea').append(imgcode);
});
 </script>

Then later in the HTML body, using this PHP to generate the initial DIV or write the new data to a text file via the filewrite() class.

 <?php
 if ($submit==true){    //$_POST['submit']
 $string = $text;       //$_POST['text'] this is where I need the POST text
 $flag=HTML;
 $scrubstring = sanitize($string,$flag,2,1200); //cleans input
 $scrubstring = trim($scrubstring);
    if ($scrubstring){
    //scrubber returns true, write text to the file.
$filewrite = new filewrite();
    //path (from root dir),string to write
$filewrite->writer("aboutus/".$file,$scrubstring);
    }
      echo '<div contenteditable="true" class="textarea">';
  echo $scrubstring.'</div>';
}else{
  $fread = new filewrite(); //instantiate the class
  $output=explode(",",$fread->readlastline($file));
  echo '<div contenteditable="true" class="textarea">';
  echo $output[1].'</div>';
    }
   ?>

So in short, I need the div “textarea” to behave like a textarea.
As always, thank you in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:51:46+00:00Added an answer on June 15, 2026 at 4:51 pm
    <script type="text/javascript">
    $(function() {
      $('#form').submit(function(){
        $('#txa').val($('#content').html());
      });
    });
    </script>
    
    <?php
      echo $_POST['txa'];
    ?>
    
    
    <div id="content">
      <h1>abcde</h1>
    </div>
    
    <form method="post" action="?" id="form">
      <input type="hidden" name="txa" id="txa" value="123" />
      <input type="submit" />
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a light-weight WPF MVVM framework, and would like to be able to
I am developing a framework and I want the jar to be light weight
I'm developing a small web frontend in Grails. It is basically a ultra light-weight
I am developing a light-weight online shop. This shop integrates with various sources. It
I'm in the process of developing my first major project. It's a light-weight content
I am developing a Java Desktop Application and want a light database that can
Developing for Android 2.3, I have a question regarding layouts. I use a vertival
I'm working on developing a rather lightweight realtime application. We're using jQuery's event system
I am developing a WPF MVVM Light application, I want to display some message
I'm developing a Silverlight WP7 app using MVVM Light Toolkit which initially works properly.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.