Jump to content

Simple form


pneudralics

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.
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.