Skip to main content
Participant
March 15, 2011
Question

php won't wrap

  • March 15, 2011
  • 1 reply
  • 825 views

I have written a form and the subsequent php page.  However, when the text moves from the html page it doesn't wrap in the php page despite the echo command within the code.

<form  action="expert page ethics 1.php" method="post">

What steps lead up to  the unethical behavior: <br />
<textarea name="txtInput1" rows="10"  cols="60"></textarea><br />
What steps should you take to  avoid the delema? <br />
<textarea name="txtInput2" rows="10"  cols="60"></textarea><br />
<input type="submit"  value="Click here to compare your answers with those of the  experts"/>

</form>

<h3>Your  Response</h3>
<h5>Steps Leading up to Unethical  behavior</h5><br/>
<?php echo  $_POST["txtInput1"];?><br/>
<h5>What steps should you take to  avoid the delema?</h5><br/>

<?php echo  $_POST["txtInput2"];?><br/>
</div>
This topic has been closed for replies.

1 reply

Günter_Schenk
Inspiring
March 15, 2011

dmaughan23 wrote:

What steps should you take to  avoid the delema?

Apply the PHP function nl2br, example:

<?php echo nl2br($_POST["txtInput2"]);?>

Participant
March 15, 2011

Thanks for the answer, but it is still not working.  It stills doesn't wrap.  Any other helpful suggestions?

This is my code with your hint included.

<?php  echo nl2br($_POST["txtInput1"]);?><br/>
Participant
March 16, 2011

dmaughan23 wrote:

I was able to make the coding work.

Can you explain what you did to make it work, so that other users may get a clue when struggeling with similar issues ?


It is a little embarrassing.  My coding was working fine, as well as yours.  To test my wrap I was just holding one key down and letting it repeat.

Using your coding nl2br I was on the php website you provided and the "line break" finally click and I realized I was not giving my code a chance to find the line break.