Hey people, I've only just recently started learning PHP. Well, March to be precise but I decided to leave it for a few weeks/a month, as I had a lot of coursework in school to catch up with. Anyway, the main reason I went back, was to prepare for a project I'm doing during the summer holidays. The project is a requirement in the course I'm doing, as it's equivilent to two units. On one side, it's a motivation to learn PHP properly, but on the other side... it's a worry, as I'd rather understand PHP fully.
Anyway, I've been creating small tests with PHP, in which I've came up with this page....
CODE
<?php
//post variables
$username = $_POST['username'];
$message = $_POST['message'];
//checks if user has submitted
if($_POST['submit'])
{
//check if username doesn't == racism, hate or stupidity
if($username == nigger || username == fuck || username == bastard || username == lulz || username == gay || username == hay)
{
echo "This username is forbidden. Please, leave immediately.";
}
//filter variables
$search_message = array("fuck", "nigger", "bastard", "lulz", "gay", "hay");
$replace_message = "censored";
$replace = str_replace($username, $search_message, $replace_message);
//check username
if($username == admin)
{
echo "<br> You cannot have the same username as the site admin</br>";
}
else if($username == $spam)
{
echo "<br>Please don't spam here.</br>";
}
//if username is ok, then submit.
else
{
echo "Thank you, $username for submitting a message.";
}
}
?>
<html>
<head>
<title>Messages</title>
<style type="text/css">
<!--
body {
background-image: url(message.jpg);
background-attachment: scroll;
background-repeat: no-repeat;
}
-->
</style>
</head>
<form id="form1" name="form1" method="post" action="anothertestomg.php">
<label><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Username:
<input type="text" name="username" id="username" />
<br />
Message :
<input type="text" name="message" id="message" />
</label>
<p>
<input type="submit" name="submit" id="submit" value="message" />
</form>
<?php
//user inputted info here
?>
<form id="form2" name="form2" method="get" action="anothertestomg.php">
<label>
<textarea name="messages" id="messages" cols="90" rows="5"></textarea>
</label>
</form>
<p> </p>
</html>
The problem... well, it's the text area (Just above^). I want to be able to display the data a user inputs through the message/username form, into the textarea. I'm unsure as to how I could do this. If you don't understand what I'm meaning, I mean... a page that's similar to an instant messenger conversation, but without the database connection, etc. Just a basic test. Can someone help me out here, please?
Help is much appreciated