Jump to content

Echo Text Area Question?


networkthis

Recommended Posts

When I use echo textarea I am running into the proplem in my form that when I hit the submit button and it posts the values back to the textarea...Then, it will automatically enter blank spaces(almost if you were hitting tab everytime)...how can you keep this from happening? 

 

Also, If you click the mouse anywhere after the required number of characters to submit, then it registers all the blanks as characters, I have tried to several things and nothing is working, any ideas???

 

Example of what I am using:

<tr><td colspan="2"><textarea cols="40" rows="6" name="message"><?php echo $message; ?>

          </textarea></td></tr>

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/105882-echo-text-area-question/
Share on other sites

hi,

 

I have not correctly understands you but i think you can try something like

 

$message=trim($_POST['message']);

  it will chop off the extra spaces...

 

<tr><td colspan="2"><textarea cols="40" rows="6" name="message"><?php echo $message; ?>

          </textarea></td></tr>

 

kindly revert back with steps what is happening exactly so one can help you in solving it.....

I want the users to have to enter in a minimum number of characters into the form and display an error message if they did not.  Of course in strlen spaces count as a character.  What was happening was if you fill out the form and had input such as this in the message box

---------------

Input

---------------

It would come back looking like this every time you would hit submit again which would echo the variable

---------------

          Input

---------------

The next time it would look like this:

---------------------------

                            Input

---------------------------

And would continually get worse every time after 2 clicks on submit the form would just submit, because the blank spaces kept being inputted. 

 

------------------------------------------------------------------------------------------

If the user would simply place the cursor anywhere in the text box in IE that was after the 20 character spot then the form would submit...even thought it was all blank.

------------------------------------------------------------------------------------------

I finally got the trim function to work with a little manipulation, but how do I prevent this from happening?  Now...........

-----------------------------------------------

I                          2                                    3

-----------------------------------------------

now the user will not receive the error message anymore, because it is not trimming the spaces between the characters.

-----------------------------------------------

 

This is driving me crazy because the rest of the form validation I have written is working perfect, displaying error messages right where they need to be and there is no way around them...... but the text area is driving me nuts!!!!!!!!!

How are you sending back the error message?

Working with what you have said, I can only guess about what is causing the problem.

Perhaps you are trying to send the error message back in place of the message and it is not displaying correctly.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.