Image

Imageremix_sakura wrote in Imagephp

external-action email form

The way I've always done email forms before if through conditionals in one page saying, in so many words....

if(isset($_POST['submit')
{check the fields, then email the data}
else
{show the form}.

but because the site i'm working on is plain html otherwise, I'd find it easier to just make the <form action="" an external file. Which seems simple enough. Except that the form won't do a damn thing: won't email, won't echo, won't even display errors. I'm pretty lost on what it could be, and the project needs to be done in the next day or so, so ideas would be appreciated.

this is what's in the external php file:

<?php ini_set ('display_errors', 1);

if (isset($_POST['submit']))
{$body = "A form has been submitted at theprmg.com\n\n

First Name: " . $_POST['firstname'] . "\n
Last Name: " . $_POST['lastname'] . "\n
Title: " . $_POST['title'] . "\n
Bsuiness: " . $_POST['business'] . "\n
Street Address: " . $_POST['streetaddr'] . "\n
City: " . $_POST['city'] . "\n
State: " . $_POST['state'] . "\n
Zip: " . $_POST['zip'] . "\n
Phone: " . $_POST['phone'] . "\n
Fax: " . $_POST['fax'] . "\n
Email: " . $_POST['email'] . "\n\n

Areas of Service:\n" .
foreach ($_POST['areas'] as $value)
{echo "$value\n";} . "\n

Information Material Request:\n" .
foreach ($_POST['materials'] as $value)
{echo "$value\n";} . "\n

Mailing List: " . $_POST['mailinglist'] . "\n\n

Comments:\n
" . $_POST['comments'];

$headers = "From: {$_POST['email']}";

mail('art@theprmg.com', 'theprmg.com Information Request Form', $body, $headers);

echo "<p>Thank you, {$_POST['firstname']}, for contacting PRMG. We will get back to you as soon as possible.</p>";}

?>