VoltronFutura
New Member
I've tried a lot of different stuff to try and get my contact form to send the name, phone, company, and message in a single email. However, all I can get is it to just send the message. I used smoovo's php code from another thread, and that's what I tried to modify to get it to work.
Here's that code
Now here's some of the stuff I've done to it to try and make it work for my needs.
What do I need to do to make it work?
Here's that code
PHP:
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail( "[email protected]", "Subject: $subject",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
else
//if "email" is not filled out, display the form
{
echo "<form method='post' action='mailform.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?>
Now here's some of the stuff I've done to it to try and make it work for my needs.
PHP:
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$subject = $_REQUEST['subject'] ;
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$company = $_REQUEST['company'] ;
$phone = $_REQUEST['phone'] ;
$message = $_REQUEST['message'] ;
$yes = $_REQUEST['yes'] ;
$no = $_REQUEST['no'] ;
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Company: $company <br>
Phone: $phone <br>
Message: $message <br>
Yes: $yes <br>
No: $no <br>
EOD;
mail( "[email protected]", $subject, $body );
}
else
//if "email" is not filled out, display the form
{
echo "<form method='post' action='mailform.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?>
What do I need to do to make it work?