Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 05-27-2010, 08:01 PM explanation needed
Extreme Talker

Posts: 173
Trades: 0
I found this excellent rich text editor on dynamic drive, got it working to display, but I cannot figure out what the variable is is storing the value that I would write to the db.

If I am not mistaken, it shoud be "+document.myform.rte1.value" and so I would just need to create the sql statement to record that value to the db. I am not familiar with the "+" so I am not sure exactly what I am doing here.


PHP Code:
<?php
// start session 
session_start();
// set up some global variables 
@include 'menu.php';
if(isset(
$_POST['rte1'])){
//sql here
echo '<html><head>';
echo 
'<META HTTP-EQUIV="REFRESH" CONTENT="4;URL=display_project_list.php">';
echo 
'</head><body>Suggestion saved.</body></html>';
die;  
}

?>
<html><head>
<script language="JavaScript" type="text/javascript" src="richtext.js"></script>
</head>
<body>
<form name="update_suggestion" action="display_comment.php" method=post>
<script language="JavaScript" type="text/javascript">
<!--
function submitForm() {
//make sure hidden and iframe values are in sync before submitting form
updateRTE('rte1'); //use this when syncing only 1 rich text editor ("rtel" is name of editor)
//updateRTEs(); //uncomment and call this line instead if there are multiple rich text editors inside the form
alert("Submitted value: "+document.myform.rte1.value) //alert submitted value
return true; //Set to false to disable form submission, for easy debugging.
}
//Usage: initRTE(imagesPath, includesPath, cssFile)
initRTE("images/", "", "");
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
//Usage: writeRichText(fieldname, html, width, height, buttons, readOnly)
writeRichText('rte1', 'here's the <em>preloaded</em> <b>content</b>', 400, 200, true, false);
//-->
</script>
<button name="submit" type="submit" tabindex="25">Submit</button>
</form>
 
</body></html>
dgkindy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-28-2010, 04:21 AM Re: explanation needed
metho's Avatar
Ultra Talker

Posts: 481
Location: Gold Coast - Brisbane QLD, Australia
Trades: 0
When the form submits, the value will be $_POST['rte1']. The content to be loaded should be outputted to:-
Code:
writeRichText('rte1', '<?php echo addslashes($content_from_db); ?>', 400, 200, true, false);
The '+' in javascript is the string concatenation symbol. The equivalent in php is '.' (period).
__________________
I do
Please login or register to view this content. Registration is FREE
based.
Spend a lot of time in
Please login or register to view this content. Registration is FREE
.
And
Please login or register to view this content. Registration is FREE
chews up the rest.
metho is offline
Reply With Quote
View Public Profile Visit metho's homepage!
 
Reply     « Reply to explanation needed
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10133 seconds with 12 queries