Flat file info not being displayed when form is re-opened - php

I am trying to create a simple "notepad" form. I have a pop-up button that when pressed will open a text file (or create one when saved if none exists). The pop up opens, the file gets created/written to. But I can't seem to pull the complete text file back up.
It all works fine until the visitor leaves the page. Meaning they can be on the page, open the file, write to it, save and close. Then, reopen it and all information is there. Add to it if they so choose, and save again. However, When they come back, everything works, except previously saved text doesn't display. It is still in the file, (verified through visual inspection through FTP) but doesn't populate the pop-up.
Still new to learning PHP and am trying to figure it out, but I am quite stuck here.
I haven't tried anything other than making sure POST is done correctly and trying to find similar problems online, but can't locate any.
<div id="myNote" class="note">
<div class="note-content">
<div class="note-header">
<span class="close">×</span>
<h2>Notepad</h2>
</div>
<div class="note-body">
<p><?php
if(isset($_POST['submit']))
{
$comment = $_POST['note'] . "\r\n";
$file = fopen($context['user']['name'] . '.php',"a+");
fwrite($file,$comment);
fclose($file);
print_r(error_get_last());
}
echo '<form action="" method="POST" name="note">
<textarea name="note" rows="20" cols="40">', $comment, '</textarea>
<input type="submit" name="submit" value="Save Note"></form>';
?></p>
</div>
<div class="note-footer">
<h3>If you close the window without saving, your notes will not be saved.</h3>
</div>

The
$comment = $_POST['note'];
Populates the textbox
What you want to add is
else {
$comment = fread($context['user']['name'] . '.php', filesize($context['user']['name'] . '.php'));
}
below your if.
should I think do the trick.

Related

Simple form with bootstrap not sending data via _POST -

First of all, this is my first question ever on stackoverflow. It's a great place to get answers from other's problems. But this time I couldn't find an answer to mine, so my question below...
I am having exactly the same issue as described in this question:
Simple form not sending data via _POST
It's exactly the same problem: even var_dump($_POST); shows me this: array(0) { } and trying to access the data passed gives me a Notice: Undefined index
I have been scratching my head for the last 2 days.
My code:
<form action="" method="POST" id="test">
<label for="email">Email</label><br>
<input type="text" name="email" id="email" value=""><br>
<input class="btn btn-primary btn-lg btn-block mb-5" type="submit" name="save-company-button" id="save-company-button" value="SAVE">
</form>
This is the simplest form and it still doesn't work. I don't understand why.
Thanks in advance for your help.
EDIT:
Content of the view:
<?php
$siteroot = SITEROOT;
// Metadata
$meta_data_title = "About us";
// Page title
$main_title = "About us";
// Additional CSS to the main CSS (bootstrap.css and custom-style.css)
$other_css = "";
// Javascript
ob_start();
require "viewAboutUs/viewAboutUs-javascript.php";
$javascript = ob_get_clean();
// Breadcrumb
$breadcrumb = "<li class=\"breadcrumb-item\">Home</li>
<li class=\"breadcrumb-item active\" aria-current=\"page\">About us</li>";
// Main content
ob_start();
require "viewAboutUs/viewAboutUs-content.php";
$main_content = ob_get_clean();
// Javascript at the bottom
$javascript_bottom = "";
// Template file
require "template.php"
?>
Content of viewAboutUs-content.php:
<form action="" method="POST" id="test">
<label for="email">Email</label><br>
<input type="text" name="email" id="email" value=""><br><br>
<input class="btn btn-primary btn-lg btn-block mb-5" type="submit" name="save-company-button" id="save-company-button" value="SAVE">
</form>
The file viewAboutUs-javascript.php is empty.
Content of the controller displayAboutUs.php:
<?php
function displayAboutUs() {
var_dump($_POST);
echo "Test: " . $_POST["email"] . "<br>";
if (isset($_POST["save-company-button"])) {
echo "Button clicked ! <br>";
}
require VIEWS_FOLDER . "/pages/viewAboutUs.php";
}
?>
Sorry for the time to provide the code, I am discovering the interface of stackoverflow...
EDIT #1
If I copy-paste the items in a simple php file that I put in my /public/ folder, it works without any problems.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<?php
var_dump($_POST);
echo "Test: " . $_POST["email"] . "<br>";
if (isset($_POST["save-company-button"])) {
echo "Button clicked ! <br>";
}
?>
<form action="" method="POST" id="test">
<label for="email">Email</label><br>
<input type="text" name="email" id="email" value=""><br><br>
<input type="submit" class="btn btn-primary btn-lg btn-block mb-5" name="save-company-button" id="save-company-button" value="SAVE">
</form>
</body>
</html>
The only thing that changes in this case is that I am using bootstrap this time. Otherwise, all my forms would work perfectly the way my code has been organised so far.
EDIT #2
After reviewing my code multiple times, the only conclusion I come to is that the issue must be located at the HTML code of the form itself. Something might be missing in the attributes of the form tag and/or one of the input tags, because the current attributes left are the bare minimum.
If somebody is a HTML5 expert, that might be useful...
EDIT #3
Things seem to indicate that what I write in my EDIT #2 are correct, because if I do a var_dump($_POST); in the main controller (index.php), just before displayAboutUs() is called, the results are the same: no data passed.
So, this form is not sending anything so far the way it is when I click on the submit button, but it does if I copy-paste it in another separate test file.
The question is: why?
After burning my brain and getting close to throwing my computer through the window, I finally got it. So I put the solution here so that other people can learn from my mistake.
The problem was coming from my .htaccess file, which was missing (I had copied-pasted the structure of a previous project as a template for my new one) and, as hidden files were not displayed, I of course missed the .htaccess when manually copying the files...
Here is the missing content that was causing so much trouble:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
So, as a reminder for myself and others, if something even dead simple is desperately not going right, check what you can't see ;-)
Hope this helps! And thanks for those who tried to help.
This question can be closed, but I can't see how to proceed...

variable in header location doesnt work in iframe?

Hi guys i am doing a personal project which i want to use on my small business, i am not that rich thats why i cant afford to hire a developer to do it for me :( my problem is that variable seems not to work if its called on an iframe, ok just like i said im not a pro developer so even on terms im not sure what to use so i will just explain on whatever i can and i hope some one can catch up with me.
an iframe is called on uikit modal, url on iframe have parameters
file is called firstreminder.php and this is the code
<?php
require_once 'layout/header.php';
if(!empty($_GET['message'])){
$sms_msg = 'https://www.experttexting.com/ExptRestApi/sms/json/Message/Send?username=xpertdotmedia&password=c61iQO1E&api_key=4aw0l0noipli133&from=LocalVerify&to=63'.urlencode($_GET['mobile']).'&text=' . urlencode($_GET['message']) . '&type=text';
$msg_json = file_get_contents($sms_msg);
$msg_array = json_decode($msg_json, true);
}
$url = $_SERVER['REQUEST_URI'];
$parts = parse_url($url);
parse_str($parts['query'], $query);
$clientid = $query['userid'];
$getinvid = $query['invid'];
?>
<form action="">
<div class="uk-margin">
<textarea rows="6" cols="50" name="message" class="uk-textarea"/><?php
echo 'Greetings,
Just a friendly reminder for your upcoming due on '.$query['date'].'
Thank you
*auto msg do not reply';
?></textarea>
</div>
<div class="uk-margin">
<?php echo '<input type="text" name="mobile" class="uk-input" value="'.$query['userphone'].'" />';?>
</div>
<div class="uk-margin">
<button class="uk-button uk-button-primary" type="submit">Send</button>
</div>
<?php
if(!empty($msg_array)){
$status = $msg_array['Status'];
if($status!="1"){
header('Location: sent.php?id='.$getinvid);
}
}
?>
</form>
<?php
require_once 'layout/footer.php';
?>
so far its working good as i can fetch value of each parameters, example i can call $query['date']whenever i want and its actually working but problem lies on header location as it doesnt seem to fetch the value of the variable, header location is called whenever the script successfully sent the sms message and then it redirect to sent.php as i want to remind the user that sms was successfully sent and also update the database and this is the code of the sent.php file
<?php
require_once 'layout/header.php';
$senturl = $_SERVER['REQUEST_URI'];
$invURL = parse_url($senturl);
parse_str($invURL['query'], $smsquery);
$invoID = $smsquery['id'];
$updateSentTo = "UPDATE ffcko_invoices_invoices SET last_sent=NOW() WHERE ffcko_invoices_invoices.id=$invoID;";
if (mysqli_query($DBcon, $updateSentTo)) {
echo '<h1 class="uk-h3 uk-text-success">Message Sent <span uk-icon="icon: check; ratio: 1.5"></span></h1>';
echo '<script>window.top.location.reload();</script>';
} else {
echo "Error: " . $updateSentTo . "<br>" . mysqli_error($DBcon);
}
mysqli_close($DBcon);
require_once 'layout/footer.php';
?>
it should go to sent.php?id=(id) so that i can successfully update the database but i always end up with this error
i tried all the combinations i can, i even transfered the code from sent.php to firstreminder.php inorder for it to have a direct control of the variable but still problem occurs as if the $getinvid is being ignored
i think it has something to do with the iframe? you think so? cause if I enter the url directly to my browser
http://localhost/sms/sent.php?id=3
adding the id manually it works as it should and it updates the database so i wonder what im doing wrong?
hope you guys can help me, thank you so much and i hope i have explained it well as english is not my native language so i really really apologize.

CKeditor displaying HTML tags in browser

I have been searching for a possible cause of this issue but I couldn't find it.
I already saw this topic here but it didn't help me.
I am building a very simple CMS using exactly this technology, plus CKeditor. Everything works just fine until I decide to add some styling on my RTE, like for instance, Bold text. When I press the Submit button, the rendered html has the [b] tags.
After some investigation I went to CKeditor's config file and wrote this: config.htmlEncodeOutput = false, which didn't help either.
What might the problem might be? To not leave any questions about my code, I leave you the code below:
A PHP file with all the editable fields that the back end picks up:
$text13 = "innehall/text13.txt";
if (isset($_POST['body13'])) {
$newData = nl2br(htmlspecialchars ($_POST['body13']));
$handle = fopen($text13, "w");
fwrite($handle, $newData);
fclose($handle);
}
if (file_exists($text13)) {
$myData13 = file_get_contents($text13);
$myData13 = $myData13;
}
The back end file:
<form id="form" name="form" method="post">
<label>Beskrivning:</label>
<textarea class="ckeditor" name="body13" id="body13">
<?php echo str_replace("<br />","",$myData13); ?>
</textarea><br>
<input id="submit" name="myBtn" type="submit" value="Uppdatera fältet" />
</form>
A php file with all the sources that the index will pick up:
$text13 = "administration/innehall/text13.txt";
if (file_exists($text13)) {
$myData13 = file_get_contents($text13);
}
The index.php
<div class="six columns">
<p><?php echo $myData13 ?></p>
</div>
Can you post the contents of the text file you are saving to - I think you will find that the tags are being escaped but want to check that first.
If the tags are being escaped when you save then you need to unescape them when you show the output not just echo.
Also I guess $myData15 is meant to be $myData13???

I haven't been able to discover how to make a button submit a FORM ~ and ALSO, work as an <a> LINK

I have scoured W3Schools, HTMLGoodies, Tizag and a dozen or 15 other ... sites; nothing really addresses this. The closest discussion I found is the Question "How best to make a link submit a form" right here on StackOverflow, but that is a little past my grasp at the moment.
Just figured with PHP and HTML, the job would be doable. Have things advanced in the last 3 years or is it still a matter of using JavaScript or some other language, and having to get into the DOM to make it all work?
Really hate to have to use one button to get the user to the spot on the page needed, then have to click a second button to open the div with the content displaying in it. Much rather they be able to click a button View Comments and the page goes to the and the content is visible.
The last 2 times I have asked a question in here, were good; one in particular I was very grateful for. Cheers! and if anyone has an answer I'd sure appreciate their help.
I could post 100 or so lines of code; a little demo, but will hold off on that. Also, didn't wish to write out the half dozen or more things I tried which were ineffectual. :)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php error_reporting(E_ALL); $MeToo = mysql_connect('localhost','root','GuessHarder'); ?>
<?php if (!$MeToo) {die ('What ~ ARE you a Novice? !!! ? : ' . mysql_error());} ?>
<?php $InestimableUtility=99; ?>
<html><Head><Title>YESH Link VIEWER</Title>
<meta http-equiv="Content-Type" content="text/html; 06 charset=iso-8859-1 application/pdf text/plain text/css text/php ">
<link rel="stylesheet" type="text/css" href="YESH Tha CSS.css"/><br />
<?php
// 3 sets of catching POSTS and setting some Vars.
$LINKfetched1=$_POST["1"];
$SleightOfHandx1= substr('\$LINKfetched1 ', 13);
$LinkzFaithfulListener1=$_POST["NICExExplosions1"];
$NICExExplosions1=99;
$LINKfetched2=$_POST["2"];
$SleightOfHandx2= substr('\$LINKfetched2 ', 13);
$LinkzFaithfulListener2=$_POST["NICExExplosions2"];
$NICExExplosions2=99;
$LINKfetched3=$_POST["3"];
$SleightOfHandx3= substr('\$LINKfetched3 ', 13);
$LinkzFaithfulListener3=$_POST["NICExExplosions3"];
$NICExExplosions3=99; ?>
</Head>
<body id="Corpus">
<div id="LinkDisplayMAIN">
<div id="TopOfLinksContainDiv">
<div id="TitlePageLxDiv"><div id="LinkViewerTitleHerSELF">
The Links Viewer
</div><!-- LinkViewerTitleHerSELF --></div><!-- TitlePageLxDiv -->
</div><!-- TopOfLinksContainDiv -->
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><hr />
<pre>
<br /><br /><a name="LinkItemDisplayDiv1">Link 1</a><br /><br />
<div id="AutoGenLINKxDIV1"><br />
<div id="ParamsTOPforLink1"><br />
<div id="DbLINKdataboxy1"><div id="abcLinkNum1"><?php
echo '&nbsp'; ?>Link DB : Link # <?php echo "1"; ?></div><!-- abcLinkNum1 --></div><!-- DbLINKdataboxy1 -->
<div id="AfterLinkNumSpacer1"></div>
</div><!-- from ParamsTOPforLink1 -->
<br /><br /><br />
<?php if($LinkzFaithfulListener1==99 and $InestimableUtility==99){ ?>
<div id="YeahBabyShowThoseNotes1">
<div id="lameDivText1">
<?php echo "In the grand scheme of things, accept that um... you know, well."; ?><br />
</div><!-- lameDivText1 -->
</div><!-- YeahBabyShowThoseNotes1 --><?php } ?>
<div id="BottleFerButtonz1">
<div id="BttnOfLinkx1y1"><div id="Fake11">
<form action="<?php echo $PHP_SELF; ?>"; method="post">
<input type="hidden"name="NICExExplosions1"value="<?php echo $NICExExplosions1; ?>"/>
<button type="submit">Show Notes About This Link</button></form>
Goto Link 1
</div><!-- from Fake11 --></div><!-- from BttnOfLinkx1y1 -->
</div><!-- from BottleFerButtonz1 --><br /><br /></div><!-- from AutoGenDBdtrmndDIV1 -->
</pre><hr /><br /><br /><br />
and a few more blocks, but that is the heart of the script;
and some closing tags.
*** Following Day Edit by OP ***
So an example code block, cleaned up is simply:
<pre>
<a name="Anchored3"></a>
<div id="AutoGenLINKxDIV3">
<div id="ParamsTOPforLink3">
<div id="DbLINKdataboxy3"><div id="abcLinkNum3"><?php
echo'&nbsp'; ?>Link DB: Link #<?php echo "3";?></div></div></div>
<?php if($LinkzFaithfulListener3==99 and $InestimableUtility==99){?>
<div id="YeahBabyShowThoseNotes3">
<div id="lameDivText3">
<?php echo "$someVariableRepresentingTextorImageOrContentofsometype";?><br />
</div></div><?php }?>
<div id="BttnOfRelease3"><div id="FakeGetOuttaJail3">
<form action="<?php echo $PHP_SELF; ?>#Anchored3"method="post">
<?php $PayloadMeNow3=$DaGoodez3; ?>
<input type="hidden"name="Liberte"value="<?php echo $Liberte; ?>"/>
<input type="hidden"name="EveryDangStepNeedsAVariable3"value="
<?php echo $EveryDangStepNeedsAVariable3; ?>"/>
<button type="submit">Return To Link Viewing</button></form>
</div></div></pre>
If you trying to send POST and GET vars you can do it by passing them in form action attribut like:
<form action="mypage.php?var1=1&var2=2&etc=n" method="post">
this will send your fields data with post method and pass GET vars in request too
I misunderstood the question. The only way to submit a form without leaving the page is to submit it with ajax. So you would want to submit it via ajax, then call whatever you ware trying to do such as open the div with the content displaying in it. see here http://www.simonerodriguez.com/ajax-form-submit-example/
<form name="MyForm" action="response_normal.php" method="post" onsubmit="xmlhttpPost('response_ajax.php', 'MyForm', 'MyResult', '<img src=\'pleasewait.gif\'>'); return false; YOURFUNCTIONHERE">
You will need to use javascript to do this. Here's a possible way to make it fallback as a normal link:
Since you are talking about comments, I think an example in terms of a blog would be most suitable. Assume that your body looks like this:
<body>
<h1>My blog post!</h1>
<p>My content</p>
View Comments
<div id="comments></div>
</body>
Here's what you can do:
If the user has javascript enable, use JQuery, YUI or your favorite JS library to send a request to http://site.com/blog/my-blog-post/comments/. Your server can detect if the request is AJAX, send back an HTML fragment containing the comments and then insert it into a comments div.
If the user does not have Javascript enabled, the user will click the link to http://site.com/blog/my-blog-post/comments/. The server can identify that the comments flag is in the link, so it will render the whole page including the comments.
This way, you can have nice AJAX loading for javascript enabled users, and fallback for users without JS.
The question was how to submit a form, and link to a particular place on the same page: with the caveat that it needed to be done with a single button click. Not only stay on the same page, but more or less at the same place on the page; not find the page at the top after the click to view additional info.
My problem was that I had incorrectly thought that an Goto XYZ paired up
with the anchor Here: XYZ would be needed, and a lot of frustrating trying out various placements of those items, led me to worry I must need some other mechanisms to achieve the goal of submitting a form in order to control the opening of a div to show the user content and yet not have the page loading at the top. Also relevant was the desire to permit the user to click a close button to hide the div once the content had been viewed, and again, not have the page open at the top.
The solution was to discover through a whole lot of trial and error, this simple bit of
syntax:
<form action="<?php echo $PHP_SELF; ?>#Anchored3"method="post">
As long as this first component Anchor 3 is in place, the other statement, does not need to be in the script and my experience was that it did harm most places I tried to situate it. The anchor alone, is sufficient.
How drop~dead simple is that!
You can submit a <form> by using the forms action parameter and <input> buttons type parameter as submit and also add an <a> link with attributes such as href='#+your div id' to get it on the same page after submitting the form.
Hope this helps you.
I also had a similar requirement and the only solution I found was to use the form to POST data to the same php file which does a database INSERT, process that post data AND THEN after that utilise curl to extract POST data modify/add more POST values and send it onto another php file like so to send an email;
//send an email
//extract data from the post
$name = $_POST['fname']." ".$_POST['lname'];
$email = $_POST['email'];
$web = "";
$group_name = $_POST['group_name'];
$message = "";
$username = $_POST['username'];
$user_id = mysql_insert_id();
//point to script
$url = 'scripts/emailer.php';
//set POST variables
$fields = array(
'article_id'=>urlencode($article_id),
'name'=>urlencode($name),
'email'=>urlencode($email),
'web'=>urlencode($web),
'message'=>urlencode($message),
'username'=>urlencode($username),
'user_id'=>urlencode($user_id),
'group_name'=>urlencode($group_name),
'messagetype'=>'new_user'
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
//open connection
$email_post = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($email_post,CURLOPT_URL,$url);
curl_setopt($email_post,CURLOPT_POST,count($fields));
curl_setopt($email_post,CURLOPT_POSTFIELDS,$fields_string);
//execute post
$result = curl_exec($email_post); //echo $result for testing
//close connection
curl_close($email_post);
// end email approvers section

Simple PHP editor of text files

I have developed a site for a client and he wants to be able to edit a small part of the main page in a backend type of solution. So as a solution, I want to add a very basic editor (domain.com/backend/editor.php) that when you visit it, it will have a textfield with the code and a save button. The code that it will edit will be set to a TXT file.
I would presume that such thing would be easy to code in PHP but google didn't assist me this time so I am hoping that there might be someone here that would point me to the right direction. Note that I have no experience in PHP programming, only HTML and basic javascript so please be thorough in any reply that you provide.
You create a HTML form to edit the text-file's content. In case it get's submitted, you update the text-file (and redirect to the form again to prevent F5/Refresh warnings):
<?php
// configuration
$url = 'http://example.com/backend/editor.php';
$file = '/path/to/txt/file';
// check if form has been submitted
if (isset($_POST['text']))
{
// save the text contents
file_put_contents($file, $_POST['text']);
// redirect to form again
header(sprintf('Location: %s', $url));
printf('Moved.', htmlspecialchars($url));
exit();
}
// read the textfile
$text = file_get_contents($file);
?>
<!-- HTML form -->
<form action="" method="post">
<textarea name="text"><?php echo htmlspecialchars($text); ?></textarea>
<input type="submit" />
<input type="reset" />
</form>
To read the file:
<?php
$file = "pages/file.txt";
if(isset($_POST))
{
$postedHTML = $_POST['html']; // You want to make this more secure!
file_put_contents($file, $postedHTML);
}
?>
<form action="" method="post">
<?php
$content = file_get_contents($file);
echo "<textarea name='html'>" . htmlspecialchars($content) . "</textarea>";
?>
<input type="submit" value="Edit page" />
</form>
You're basically looking for a similar concept to that of a contact-form or alike.
Apply the same principles from a tutorial like this one and instead of emailing using mail check out the file functions from PHP.net.
What did you Google on then? php write file gives me a few million hits.
As in the manual for fwrite():
<?php
$fp = fopen('data.txt', 'w');
fwrite($fp, '1');
fwrite($fp, '23');
fclose($fp);
// the content of 'data.txt' is now 123 and not 23!
?>
But to be honest, you should first pick up a PHP book and start trying. You have posted no single requirement, other than that you want to post a textfield (textarea I mean?) to a TXT file. This will do:
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
$handle = fopen("home.txt", 'w') or die("Can't open file for writing.");
fwrite($fh, $_POST['textfield']);
fclose($fh);
echo "Content saved.";
}
else
{
// Print the form
?>
<form method="post">
<textarea name="textfield"></textarea>
<input type="submit" />
</form>
<?php
}
Note that this exactly matches your description. It doesn't read the file when printing the form (so every time you want to edit the text, you have to start from scratch), it does not check the input for anything (do you want the user to be able to post HTML?), it has no security check (everyone can access it and alter the file), and in no way it reads the file for display on the page you want.
First thing to do is capture the information, the simplest way to do this would be the use of a HTML Form with a TEXTAREA:
<form method='post' action='save.php'>
<textarea name='myTextArea'></textarea>
<button type='submit'>Go</button>
</form>
On 'save.php' (or wherever) you can easily see the information sent from the form:
<?php
echo $_POST['myTextArea']
?>
To actually create a file, take a look at the fopen/fwrite commands in PHP, another simplistic example:
<?php
$handle = fopen("myFile.txt","w");
fwrite($handle,$_POST['myTextArea'];
fclose($handle);
?>
WARNING: This is an extremely simplistic answer! You will perhaps want to protect your form and your file, or do some different things.... All the above will do is write EXACTLY what was posted in the form to a file. If you want to specify different filenames, overwrite, append, check for bad content/spam etc then you'll need to do more work.
If you have an editor that is publicly accessible and publishes content to a web page then spam protection is a DEFINITE requirement or you will come to regret it!
If you aren't interested in learning PHP then you should think about getting a professional developer to take care of any coding work for you!
I had a similar need so we created a client-friendly solution called stringmanager.com we use on all our projects and places where CMS is not effective.
From your side, you just need to tag string in the code, i.e. from:
echo "Text he wants to edit";
to:
echo _t("S_Texthewantstoedit");
stringmanager.com takes care about the rest. Your client can manage that particular text area in our online application and sync wherever he wants. Almost forgot to mention, it is completely free.
Can use this line of code :
<form action="" method="post">
<textarea id="test" name="test" style="width:100%; height:50%;"><? echo "$test"; ?></textarea>
<input type="submit" value="submit">
</form>
<?php
$file = "127.0.0.1/test.html";
$test = file_get_contents('1.jpg', 'a');
if (isset($_POST['test'])) {
file_put_contents($file, $_POST["test"]);
};
?>
<form action="" method="post">
<textarea id="test" name="test" style="width:100%; height:50%;"><? echo "$test"; ?></textarea>
<input type="submit" value="submit">
</form>
Haven't had time to finish it, simplest possible, will add more if wanted.

Categories