Solved

Form Posting TextArea (No Text)

Posted on 2011-09-05
9
369 Views
Last Modified: 2012-05-12
Hi all,

I have a problem when posting the data of a form (field).

I have a Textarea in my form:

<label for="eh-textarea-desc">Description:</label>
<textarea cols="40" rows="8" name="eh-textarea-desc" id="eh-textarea-desc"></textarea>

Open in new window


I this post(submit) the text that I've written ...

My php collects the data ..BUT no Description .. instead I get "on" (without quotes), which is what I would expect to get from a checkbox not a textarea ... anyone got any idea why this could happen?

Thanks






0
Comment
Question by:error77
  • 4
  • 3
  • 2
9 Comments
 
LVL 24

Expert Comment

by:mankowitz
ID: 36485786
it should work as expected. Show us the rest of the form as well as the php script you are using to handle it. Two things come to mind

1. Is there another part of your form called eh-textarea-desc?
2. Is your php script overwriting your variable?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36485832
I agree, that should work in a form.  And you have two items with the same name, I think you will only 'see' the second or last one.   I think you need to show us more code cause something isn't quite right.
0
 

Author Comment

by:error77
ID: 36485839
This is what I've done:

First I define a variable and set to empty

$ehTextareaDesc = '';

Then I assign the variable to the post

if(isset($_POST['eh-textarea-desc'])) {
             $ehTextareaDesc = $_POST['eh-textarea-desc'];
      }

Note: The above is to avoid undefined errors

Then on the form I have this:

<label for="eh-textarea-desc">Description:</label>
<textarea cols="40" rows="8" name="eh-textarea-desc" id="eh-textarea-desc"></textarea>


Then once I submit I have the php to show me what has been passed:

echo 'The Description Posted is '.@$_POST["eh-textarea-desc"];

The above is returning "on"

Hope this helps.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36485870
Why do you have the '@' symbol?  Use:

echo 'The Description Posted is '.$_POST["eh-textarea-desc"];
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36485875
What are you typing into the textarea before you POST it?
0
 

Author Comment

by:error77
ID: 36485905
I'm posting just any text..for example: "This is a textarea description"

0
 

Author Comment

by:error77
ID: 36485955
OK, I've been doing some more test and here are the results:

I currently navigate to the textarea field using sub lists

example:

<ul>
<li><a href="#">Go to the Textarea</a>
<ul>
<li>
<textarea></textarea>
</li>
</ul>
</li>
<ul>

So I navigate to the textarea ... type whatever .. hit the back arrow and submit.

For some reason the form is not retaining the data when I submit it although if I navigate back to it the data IS there.

Any ideas on why this might be happening?



</li>
0
 
LVL 24

Expert Comment

by:mankowitz
ID: 36486101
try this:

first line of your script

print "<pre>";
print_r ($_POST);
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 36486149
Why would the form retain the data?  That description doesn't make any sense.

Here are a set of files I made up for another question that demonstrate posting data from one page to another including a <textarea>.

formA.html
formA1.php
formA2.php
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now