Jump to content

Archived

This topic is now archived and is closed to further replies.

pneudralics

Simple form

Recommended Posts

I'm starting to learn php and trying to create a simple form.

This is my html page:

[code]<form action="handle_post.php" method="post">

First Name: <input type"text" name="first_name" size="20" />
<br />
Last Name: <input type="text" name="last_name" size="20" />
<br />

Email Address: <input type="text" name="email" size="20" />

<br />

Posting: <textarea name="posting" rows="3" cols="30"></textarea>
<br />

<input type="submit" name"submit" value="Send My Posting" />
</form>[/code]

This is my handle_post.php page:

[code] <?php

$first_name = "$first_name";
$last_name = "$last_name";
$posting = "$posting";

$name = $first_name . ' ' . $last_name;

echo "thank you, $name, for posting the following: <br />
<p>$posting</p>";

?>[/code]

When I click the submit button it downloads instead of going to the php page. What did I do wrong? Thanks for helping this newbie out.

Share this post


Link to post
Share on other sites
Sounds like your web server isn't configured correctly. Apache needs to know to treat .php files differently from the rest. Check the PHP documentation for how to install correctly.

Share this post


Link to post
Share on other sites
Well, first, are you sure your server has PHP installed? You might want to check that before anything.
And, second, are you using $_POST to get the values before this code?
Thirdly, you don't need to do $var = "$var", that's just wasting milliseconds :P

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.