Hi, this is a simple PHP script witch will say what you put in the text boxes! Just open notepad and put this code in, make sure you save it as "talk.php" or it wont work. Once done, upload to your FTP server. And it should work! Have fun!!
<html>
<body>
<!-- Form -->
<form action="talk.php" method="POST">
Text1:<input type="text" name="text1"><br>
Text2:<input type="text" name="text2"><br>
<input type="submit" name="submit" value="Say!">
</form>
</body>
</html>
<?php
//Text generator code
if ($_POST['submit'])
{
$text1 = $_POST['text1'];
$text2 = $_POST['text2'];
if ($text1&&$text2)
{
echo "Text1: " . $text1 . "<br>";
echo "Text2: " . $text2 . "<br>";
}
else
die("Please fill in all boxes!");
}
?>
just as a reference, check out http://php.net/manual/en/function.extract.php
through rather redundant in this snippet, it'll save you from renaming your vars if using the array index as a name scheme.
I'd personally use single quotes instead of doubles in your echo statements as you're not using any line returns etc. and there's no reason to use die() considering it's at the very end of this snippet, an echo would suffice
otherwise nice starter. look forward to seeing more php :)
i voted 4/10 for mediocre ( we really need a better voting system )