Jump to content


Photo

Simple form


  • Please log in to reply
3 replies to this topic

#1 pneudralics

pneudralics
  • Members
  • PipPipPip
  • Advanced Member
  • 241 posts

Posted 03 March 2006 - 01:12 AM

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

This is my html page:

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

This is my handle_post.php page:

<?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>";

?>

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.

#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 03 March 2006 - 01:27 AM

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.

#3 dcro2

dcro2
  • Members
  • PipPipPip
  • Advanced Member
  • 489 posts

Posted 03 March 2006 - 01:30 AM

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

#4 pneudralics

pneudralics
  • Members
  • PipPipPip
  • Advanced Member
  • 241 posts

Posted 03 March 2006 - 01:43 AM

Thanks I figured out what it was.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users