Jump to content

Problem with Textarea


SJames

Recommended Posts

I have the following two files.

 

<?php
          print "<form method=post action=\"secondfile.php\">
          $variable = "Text";
          $content = "<a name=\"$variable\">$variable</a>";

          // There is a \ before the "$var..., but for some reason it doesn't show up on this webpage.
          
          print "<textarea name=\"content\">$content</textarea>";
          print "<input type=submit>";
          print "</form>";
?>

 

secondfile.php

<form method=post action="otherfile.php">
          <textarea name="content">
                    <?php print $_POST['content']; ?>
          </textarea>
          <input type=submit>
</form>

 

Obviously these files have been simplified and had filenames changes, but my problem persists even with these simple files.

 

These files work properly, but what is printed in the textarea on the second page is not correct. It should be equal to $content from the first page, or:

<a name="Text">Text</a>

however, what is printed is:

<a name=\"Text\">Text</a>

I don't know why it is adding the \ , any help would be nice.

Link to comment
https://forums.phpfreaks.com/topic/66826-problem-with-textarea/
Share on other sites

Hi..

        this is because you are using it with echo or print.. so you have to add it..

        have changed some code over here:

 

<?php
print "<form method=post action=\"secondfile.php\">";
        	$variable = "Text";
          $content = "<a name=\"$variable\">$variable</a>";

          // There is a \ before the "$var..., but for some reason it doesn't show up on this webpage.
          
          print "<textarea name=\"content\">$content</textarea>";
          print "<input type=submit>";
          print "</form>";
          ?>

 

suppose this will help you..

Vijay

Link to comment
https://forums.phpfreaks.com/topic/66826-problem-with-textarea/#findComment-335016
Share on other sites

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.