Solved

Form Posting TextArea (No Text)

Posted on 2011-09-05
9
377 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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
 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

776 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