how do i write textarea value from $repvalue value if the condition is true please help me.
<html>
<body>
<form action="find4.php" method="post" name="finrep">
<p>Find: <input type="text" name="fin">Replace: <input type="text" name="rep" >
</p>
<p><br/>
<textarea name="comments" cols="25" rows="5" value="<?php echo $repvalue; ?>"></textarea>
<input type="submit" name="submit1" value="submit">
</p>
</form>
</body>
</html>
<?php
if ($_POST['submit1'])
{
$findval = $_POST['fin'];
$textboval = $_POST['comments'];
if($findval == $textboval){
$repvalue = $_POST['rep'];
}
}
?>
Close, but for a textarea
you actually place the text between the tags, like this:
<textarea name="comments" cols="25" rows="5"><?php echo $repvalue; ?></textarea>
Also, you may want to clean the value of $repvalue
with htmlenitites before outputting it, as any </textarea>
tags in the variable will break your page.
And as per charlietfl's comment you need to make sure your definition of $repvalue
needs to be before you try to output it (nice catch, didn't even look at that).
You must put the textarea value in between the tags
<textarea><?php echo $repvalue; ?></textarea>