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 7778269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:21:20+00:00 2026-06-01T18:21:20+00:00

I have a page with a WYSIWYG editor the user can use. After editing,

  • 0

I have a page with a WYSIWYG editor the user can use. After editing, they can press a button, and the javascript should POST the current page to a save.php file and refresh the page with new information.

There are two problems. The first is that initially the page doesn’t load with the updated file. The user has to refresh the page to see it updated (maybe it just takes an extra second to write the file?). The second problem, is that after the first time the temporary file was created, it cannot be overwritten, so the page never updates after the first refresh. Here are the snippets I’m working with:

Javascript function on the WYSIWYG editor page (editor.php):

function refresh(html,username,info)
{
    $.post("save.php", { html: html, username: username } );
    window.location = 'editor.php?info=' + info;
}

save.php file

$html = $_POST['html'];
$username = $_POST['username']; 
file_put_contents('temp/' . $username . '.txt', $html);
  • 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-01T18:21:21+00:00Added an answer on June 1, 2026 at 6:21 pm

    As the browser may not have issued the POST request before navigating to the next page, use the success callback from the post to do the relocate:

    function refresh(html,username,info) {
      $.post("save.php", { html: html, username: username }, function() {
        window.location = 'editor.php?info=' + info;
      });
    }
    

    As other people have already commented, using data directly from a form post without sanitising it is a really bad plan and opens your server up to all kinds of malicious attacks. Have a look at some of these questions: https://stackoverflow.com/search?q=sanitize+php

    If the data is getting to your server ok, make sure that the access permissions on the directory ‘temp’ allow write access from the web server user (if you have access to SSH to your server, run chmod go+w /path/to/temp, otherwise most FTP programs allow you to set file permissions too).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page which should show a form with checkboxes, post back if
I want a WYSIWYG html editor to create a static web page. After some
I have text widgets that can be added on the page. A click should
I am looking to use a wysiwyg javascript editor. What I want to do
I have page where I use model which can have different types (depending by
We have an internal asp.net forms app where one page is essentially a WYSIWYG
I have page which is redirected from htaccess. now I can pass the German
I have page, i can contact directly without any problems. http://www.mysite.com/app_dev.php/comments/22 the page shows
I need something simple; I have page where a user clicks an author to
I am making a WYSIWYG webpage editor: http://brokenmyriad.com/editor2.php , however I have come across

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.