I have a Textarea, and I want to store value in a variable.
The condition is that the value will be fetch from JS that is Document.FormName.Combox1.Value in the same page. I know $_POST method..

Recommended Answers

All 11 Replies

Your question is not very clear. Could you please clarify if you want to get the data into a JavaScript variable or a PHP variable.

Thanks.

I want to store in PHP variable

If you want to transfer the value of the textarea to PHP with page refresh use $_POST['textarea'] which you already said you know.

If you want to do it without refreshing the page then you would need AJAX.

Actually, I want to store that value into the database. Using script, the textarea's value that I needed; not by using $_POST, there is any solution to do this.

It looks like you would be needing AJAX. That would be a way to send the data from the HTML page to PHP using Javascript. I would utilize the GET or POST methods, but the page will not refresh. Is there a reason you do not want to use POST.

If you can give me a heads up on what application you are trying to build I'll probably be able to suggest a solution.

Check out http://www.w3schools.com/ajax/default.asp for an AJAX tutorial. Might be you'll find what you are looking for.

commented: Genious +1

I have form where there is WYSIWYG text area, that contain formatted textarea content, when I use POST it gives only simple value; I need all HTML tags that used to format the text, because that formatted text have to send into emails id using MIME format. I got the value document.from.combox1.value. I am attached an image.

Are you sure that document.from.combox1.value has the value with the html tags?

In see if you use alert(document.from.combox1.value) and see if you are getting the value with the tags as well. If not then you need to see the documentation of the WYSIWYG editor and check as to what you need to use.

If you let me know which editor you are using, I'll check the documentation for you.

Yes, alert(document.form.combobox1.value) is showing the value with all tags; but not in POST method. I am using MICROSOFT Expression Web 2.0

I am attaching the whole project.

tinymce/examples/a.php is the page, when you click the submit button you will see the all in the alert box..

Sorry,
Forget the attachment..

I checked it and I am getting the html tags in the post method. Put the following at the top of the file and check.

<?
	$val=$_POST['elm1'];
	echo htmlentities($val);
?>

When you submit the form, it will print the HTML code on the top of the page. I suppose you can use the same to put it into the DB.

You are genious Sudeep...

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.