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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.