Trouble with simple PHP

Discussion about non-BR issues : Operating Systems, Networking issues and other non-BR related software products (AutoIt, other open source recommendations, etc)

Moderators: Susan Smith, admin

Post Reply
James Lowman

Trouble with simple PHP

Post by James Lowman »

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
James Lowman

Post by James Lowman »

The code does not show up in Email but it is in Brforum.ADS.NET. Under Non-Br related
Chris Shields
Posts: 22
Joined: Thu Aug 06, 2009 12:19 am

Post by Chris Shields »

Looks like your are just missing some quotes and some other small syntax issues. I made some corrections.

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>
And the PHP

Code: Select all

<?php 
echo "<p>Welcome <b>".$_POST["user"]."</b>!</p>";
echo "<p>Your message is:<br /><b>".$_POST["message"]."</b></p>";
?>
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
Post Reply