2

I want to create a webpage that posts onto itself text inserted into an input field, using CSS to stylize said text once it becomes part of the page. However, I don't know how to refer to it with a CSS selector. I've done what every HTML-newb tries when encountering a problem and wrapped both the form code and PHP statement in classified DIVs, however, the computer visibly doesn't know what I'm trying to address. Likewise, wrapping the PHP statement in paragraph tags doesn't apply to it the stylization said tags are associated with.

For Reference, Form & PHP Code:

<form method = "post">
<textarea name="input"></textarea>
<input type="submit">
</form>

<?php echo $_POST['input'];?>

My apologies if the solution to this is obvious; I can't find information addressing it.

2 Answers 2

2

you could inline style it or with a class.

<form method = "post">
  <textarea name="input"></textarea>
  <input type="submit" name="submit">
</form>
<div class="input-value">
<?php 
if(isset($_POST['submit])) {
  echo $_POST['input'];
}
?>
</div>

use .input-value class in css

Sign up to request clarification or add additional context in comments.

Comments

1

Please try this!

<form method = "post">
<textarea name="input"></textarea>
<input type="submit">
</form>
<?php echo "<div style='color:red;font-family:verdana;font-size:300%'>" . 
$_POST['input'] . "</div>" ?>

Are you looking for this? Please let me know! Thanks!

2 Comments

This worked perfectly; I chose the other answer as the solution due to the fact that styling the output with a class is more convenient than doing so inline, but your answer's a big help. Thank you!
:) Thanks for letting me know your feedback!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.