Skip to main content
Inspiring
October 15, 2007
Question

Php Form Help

  • October 15, 2007
  • 1 reply
  • 725 views
I just developed a simple php form (my first time). I am trying to enable the information that is typed in the form by visitors, to be emailed directly to me. So far I can only get the person's email address and message left in information box to be sent to my email address. However, there are other contents within the form that I also need to receive. Can anyone help.

http://www.newnie.com/informationform.php
http://www.newnie.com/handle_form.php
This topic has been closed for replies.

1 reply

Inspiring
October 15, 2007
On 15 Oct 2007 in macromedia.dreamweaver.appdev, CellaMarr wrote:

> I just developed a simple php form (my first time). I am trying to
> enable the information that is typed in the form by visitors, to be
> emailed directly to me. So far I can only get the person's email
> address and message left in information box to be sent to my email
> address. However, there are other contents within the form that I
> also need to receive. Can anyone help.

http://www.php.net/mail

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php
Inspiring
October 17, 2007
On 17 Oct 2007 in macromedia.dreamweaver.appdev, CellaMarr wrote:

> Here is the code I used for
> http://www.newnie.com/informationform.php and
> http://www.newnie.com/handle_form.php
> Can anyone take a look at it and tell me what I am missing that is
> preventing the form from mailing the info to my email address?

Works on mine. If the webforum didn't bork your code, then this might
be the problem:

<form action="handle_form.php"method="post">

You're missing a space between " and method; should be:

<form action="handle_form.php" method="post">

If that isn't it, you're going to have to ask your hosting provider
whether they have access to sendmail turned on for PHP scripts.

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php
Inspiring
October 18, 2007
On 18 Oct 2007 in macromedia.dreamweaver.appdev, CellaMarr wrote:

> When I fill out the form and press send the only information that I
> receive is the "First Name", "Email Address", and "Project Details".
> All the other info does not show up. Why will it only send some of
> the information and not all of it? ("Phone Number", "Profession",
> "Budget", "Hosting", and "Domain")

Because you're not telling it to send them to you. Consider:

$success = mail($to, $subject, $detail, $headers);

This line is correct and sends the email as it should. You're telling
it that you want $detail as the body of the message. However, when you
load variables:

$name = $_POST['name'];
$email = $_POST['email'];
$number = $_POST['number'];
$detail = $_POST['detail'];
$profession = $_POST['profession'];
$entertainer = $_POST['entertainer'];
$domain = $_POST['domain'];
$hosting = $_POST['hosting'];
$subject = 'Message from newnie.com'; // this is the subject line. you
can make this say whatever you want
$headers = "From: $name <$email>\n";
$headers .= "Reply-To: $name <$email>\n";

$to = 'cellamarr@mac.com'; //change this to your email

you're only putting the contents of the 'detail' form field into
$detail. You need to do something more like:

$body = 'Name: ' . $_POST['name'] . "\n";
$body .= 'EMail: ' . $_POST['email'] . "\n";
$body .= 'Number: " . $_POST['number'] "\n";
// etc
$subject = 'Message from newnie.com'; // this is the subject line. you
can make this say whatever you want
$headers = "From: $name <$email>\n";
$headers .= "Reply-To: $name <$email>\n";

And your mail() statement becomes:

$success = mail($to, $subject, $body, $headers);

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php

On 18 Oct 2007 in macromedia.dreamweaver.appdev, CellaMarr wrote:

> I made the changes you suggested and now the form wont send
> anything to my email.

It would help an awful lot to see the code...

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php