PHP: Main
After just recently learning PHP, I thought I'd give this a shot. No clue as to how this could be used, but whatever. So what we are going to do is make an "application" that allows us to print whatever the user types into a text field. Create a file called "Text_Display.php" (Case-sensitive!), and save it. Paste the following code into the page:
<html>
<body>
<?php
//Checks to see if something was submitted.
if (isset($_POST['submitted'])) {
//Defines the variable message. Message comes from the text field message.
$message = $_POST['message'];
//Echoes $message
echo $message;
}
?>
<form action="Text_Display.php" method="post">
<p>What's your message?</p>
<!--This is text field message.--!>
<input type="text" size="25" maxlength="100" name="message" value="<?php if(isset($_POST['message'])) { echo $message;} ?>"
/>
<!--Submit Button and a Hidden Text Field that makes sure the text gets displayed.--!>
<input type="submit" value="Display!" name="submit" /></td>
<input type="hidden" name="submitted" value="TRUE" />
</table>
</form>
</body>
</html>
There you have it. I just want to add that I read Momo_The_Monkey's tutorial, and based this off of his. The PHP is 100% redone, but some of the HTML was done by him, and hasn't been removed. But some has also been written my me. I pray he won't smite me.