0

i have a textarea with alot of words in it. Is there an alternative way to send the words in the textarea to another page without using a form and submit button?

4
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by vibhaJ
0

I'm not really sure what you're trying to do, but if you don't want the page to reload you can use AJAX (javascript) to send data across web pages asynchronously. It's a bit confusing if you're new at javascript, you can also use Jquery to make it easier for you.

Edited by qazplm114477: n/a

-1

Is there an alternative way to send the words in the textarea to another page without using a form and submit button?

Yes, you can use a PHP Session:

Grab text from textarea and put it into a session:

<textarea name="text"> </textarea>

<?php
    $texttosend = $_POST['text'];
    $_SESSION['textareatext'] = $texttosend;
?>

Print it out on the next page:

<?php echo $_SESSION['textareatext'] ?>

Something like this should work... but not sure

0

but without the <form>, the browser wouldn't know if it's using a $_GET or $_POST method, and without submitting the form no value can be sent to the server and PHP is a server side programming language.

0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
	function sendTextarea()
	{
		var text = escape(document.getElementById('tb').value);
		window.location.href='second.php?tb='+text;
	}
</script>

</head>

<body>
<textarea id="tb">this is text</textarea>
<input name="Pass" value="Go To Second Page" onclick="sendTextarea();" type="button" />
</body>
</html>

this is example code you can use.
hope it will help you.
even you can decode passing text using base64decode.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.