text area content gets moved (SOLVED)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thosecars82
Forum Commoner
Posts: 94
Joined: Thu Apr 03, 2008 6:31 am
Location: Arganda, Madrid
Contact:

text area content gets moved (SOLVED)

Post by thosecars82 »

hello there
I have a problem with the text area which holds the content of an email. Please, you can look at http://www.metatradersoftware.com, in the contact section. If you write something in the content and click Send, then you will see a second screen. Then if you click go back, you will come back to the first screen and you will still see almost the same content for the email you wrote. It's not exactly the same because each time you go from 1st to 2nd screnen and go back, the text you wrote gets moved some positions to the right. I have checked that the session variable which holds the email content still has the correct value, that is to say, the text has not moved in this variable. Therefore, I do not know why this happens. I just might think of the cursor position as the culprit which might be moved each time I do echo "..." inside the text area of the email content but I still do not know any concrete solution.

On the other hand, if you write something on the text area of the email subject and click send and then you click go back, you will be able to check that the text of the subject does not get moved to the right in contrast to the email content. This is weird because both text areas, the one for the subject and the one for the content are really similar.


The code:
<FORM name="email" id = "idemail" action="contact2.php" method="post">
<?php echo _("Subject");?>
<textarea name="emailsubject" id="idemailsubject"
onkeyup="if (this.value.length > 45) this.value = this.value.substring(0, 45)"
maxlength="45">
<?php
if (isset($_SESSION['emailsubject']))
echo $_SESSION['emailsubject'];
?>
</textarea>
<P>
<?php echo _("Content");?><br />

<TEXTAREA name="emailcontent" id="idemailcontent" rows="5" cols="50">
<?php
if (isset($_SESSION['emailcontent']))
echo $_SESSION['emailcontent'];
?>
</TEXTAREA>

<?php echo "<INPUT name='send' type='submit' value='";
echo _("Send") . '\'>';
echo "<INPUT type='button' value='";
echo _("Reset") . "' onClick=resetea()>";
?>
</P>
</FORM>


Do you have any idea to avoid that the text from the email content gets moved when someone clicks goback from the second screen? I mean, you might think this is not a big deal for using the web. Nonetheless, it is something I am interested in learning to solve.
Thanks in advance
Last edited by thosecars82 on Mon May 26, 2008 6:10 am, edited 1 time in total.
User avatar
deeessay
Forum Commoner
Posts: 55
Joined: Sat May 24, 2008 1:02 am

Re: text area content gets moved

Post by deeessay »

are you using css?

try this:

<TEXTAREA style="text-align: left" name="emailcontent" id="idemailcontent" rows="5" cols="50">
thosecars82
Forum Commoner
Posts: 94
Joined: Thu Apr 03, 2008 6:31 am
Location: Arganda, Madrid
Contact:

Re: text area content gets moved

Post by thosecars82 »

deeessay wrote:are you using css?

try this:

<TEXTAREA style="text-align: left" name="emailcontent" id="idemailcontent" rows="5" cols="50">
I already solved by removing the spaces between the textarea tags and the <?php and ?> tags.
Thanks anyways.
Post Reply