Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Form Posting TextArea (No Text)

Posted on 2011-09-05
9
Medium Priority
?
414 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 84

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 84

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 84

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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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

Hire Technology Freelancers with Gigs

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

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.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

610 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