473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

[SOLVED] printing textarea variable

Hi this is my first post and i have a question about php.

I want to print a variable from textarea and print it in php but when i do all te returns are turned in to spaces. I have used wrap"hard" to include all returns but it doesn't show in php. Or do i have to split the text array with "substr()? Please advise

this is my code.

[PHP]
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<?php if ($sendbutton != "send" || !$text) {
?>
<form action="form.php" method="post">
<textarea name="text" cols="50" rows="5" wrap="hard"></textarea><br>
<input name="sendbutton" type="submit" value="send">
</form>
<?php } else {
print "text<br>";
print $text ;
} ?>
</body>
</html>
[/PHP]
Oct 31 '06 #1
2 2526
ronverdonk
4,258 Expert 4TB
There is no value $sendbutton, unless you assign something to it.
Also, when you POST a form, you must capture the data in the $_POST array when the script is invoked again. I changed your snippet to demonstrate this.
[php]<?php
if (isset($_POST['sendbutton'])) {
echo nl2br(strip_tags($_POST['text']));
exit;
}
?>
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<textarea name="text" cols="50" rows="5"></textarea><br>
<input name="sendbutton" type="submit" value="send">
</form>
</body>
</html> [/php]
Ronald :cool:
Oct 31 '06 #2
thanks that is what i ment.
Nov 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: google | last post by:
I would like to print a table, using a while loop to insert as many blank text fields as players specified by the user. How do I put html inside a php loop. This is what I have.... <body>...
4
by: Doug van Vianen | last post by:
Hi, I am working on an Applet which provides some mouse practice for new computer users in our local seniors' computer club. The applet contains several cards, in a card layout, which are...
5
by: lawrence | last post by:
How to add text to a textarea using javascript? Apparently this is a popular question, because when I run the search on google, there are a lot of returns: ...
6
by: lkrubner | last post by:
I'm offering users the ability to type weblog posts into a form and post them. They type the text into a TEXTAREA which is on a form. The form, when submitted, hits a PHP script. Before it is...
1
by: Garry Jones | last post by:
I have been using this code for sometime. I can use it to show the user how many remaining characters are reamaining in a text area. Now I need to develop the code and dont know where to start. ...
3
by: lintolawrance | last post by:
sir, i am starting working with php.i done some programs.but now i have one problem.i do a program like to retrieve the name and email from a phpfile to another.but i can't get. this is the code...
16
by: Jen | last post by:
Hi. I have this problem that I think should be easy but have been struggling with this for days. I have a list based on a recordset from a database. This list consists of records meeting a certain...
0
by: Germaris | last post by:
Hi there! I implemented a printing function which is working nice even for multiple pages. Problem is as follows... Say we have a text 100 lines long. Each page can hold 80 lines. We should...
10
by: agun | last post by:
Hello, question 1: how do i get textarea value to javascript variable if the textarea contains linefeed? it only works if the textarea contains no linefeed. var jtext =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.