I'm trying to display two values in a textbox but the value should be next line. here is my sample query. here i tried
also its not working. give me a idea to display in a next line.... thank you..
</head>
<?php
$s='hi';
?>
</br>
<?php
$d='how are you';
?>
<body>
<form id="form1" name="form1" method="post" action="">
<label>
<input type="text" name="textfield" value="<?php echo $s."<br />"; echo $d?>" id="textfield" />
</label>
</form>
Use a textarea, and line breaks instead of <br>
elements.
<textarea name="textfield"><?php echo $s."
".$d; ?></textarea>
to output the contents of the textarea in a HTML document with proper line breaks, use nl2br()
.
You cannot display line breaks in textfields (input type="text"). You will need a <textarea>
for that.
Use <textarea><?php echo $s." ".$d; ?></textarea>
You should use
<textarea><?php echo $s."
"; echo $d?></textarea>
instead of
<input type="text"
because textbox supports only single-line text