Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Php Form Help

Participant ,
Oct 14, 2007 Oct 14, 2007
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
TOPICS
Server side applications
727
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 15, 2007 Oct 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 17, 2007 Oct 17, 2007
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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 17, 2007 Oct 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 18, 2007 Oct 18, 2007
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")
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2007 Oct 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 18, 2007 Oct 18, 2007
I made the changes you suggested and now the form wont send anything to my email.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2007 Oct 18, 2007
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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 18, 2007 Oct 18, 2007
Here you go
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 19, 2007 Oct 19, 2007
LATEST
On 18 Oct 2007 in macromedia.dreamweaver.appdev, CellaMarr wrote:

> Here you go

Try this:

$body = 'Name: ' . $_POST['name'] . "\n";
$body .= 'EMail: ' . $_POST['email'] . "\n";
$body .= 'Number: ' . $_POST['number'] . "\n";
$body .= 'Detail: ' . $_POST['detail'] . "\n";
$body .= 'Profession: ' . $_POST['profession'] . "\n";
$body .= 'Entertainer: ' . $_POST['entertainer'] . "\n";
$body .= 'Domain: ' . $_POST['domain'] . "\n";
$body .= 'Hosting: ' . $_POST['hosting'] . "\n";
$subject = 'Message from newnie.com'; // this is the subject line. you can make this say whatever you want
$headers = 'From: ' . $_POST['name'] . '<' . $_POST['email'] . '>';

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

$success = mail($to, $subject, $detail, $headers);
if($success){
echo '&sent=OK';
}else{
echo '&sent=Error';
}

Copy and paste exactly as above.

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines