I am trying to learn PHP for a small program that will be used with the new Bridge. I have written this:
<html>
<head>
<title>Simple Test</tittle>
</head>
<body>
<form action="formtest.php" method="POST"
<p>Name:<br />
<input type="text" name="user"/></p>
<p>Message:<br />
<textarea name="message" rows="5" cols=40"></textarea></p>
<p>input type="submit" value="send"/></p>
</form>
</body>
</html>
FORMTEST.PHP
<? php
echo"<p>Welcome <b>".$_POST["user"]."</b>!</p>;
echo"<p>Your message is:<br /><b>".$_POST["message"]."</b></p>";
?>
And the output that I get is:
Welcome ".$_POST["user"]."!
?>
What have I done wrong??
Jamie Lowman
Trouble with simple PHP
Moderators: Susan Smith, admin
-
- Posts: 22
- Joined: Thu Aug 06, 2009 12:19 am
Looks like your are just missing some quotes and some other small syntax issues. I made some corrections.
And the PHP
I use an IDE called Apatana for this stuff. It flags syntax mistakes immediately so you don't spend so much time hunting for missing semicolons and quotes.
Hope that helps.
-Chris
Code: Select all
<html>
<head>
<title>Simple Test</title>
</head>
<body>
<form action="formtest.php" method="POST">
<p>
Name:
<br/>
<input type="text" name="user"/>
</p>
<p>
Message:
<br/>
<textarea name="message" rows="5" cols=40>
</textarea>
</p>
<p>
<input type="submit" value="Submit..." />
</p>
</form>
</body>
</html>
Code: Select all
<?php
echo "<p>Welcome <b>".$_POST["user"]."</b>!</p>";
echo "<p>Your message is:<br /><b>".$_POST["message"]."</b></p>";
?>
Hope that helps.
-Chris