Page 1 of 1

potential permissions problem

Posted: Wed Aug 18, 2004 4:17 pm
by ggordon
Hi,

I'm using PHP for the first time and I've run into a problem.

I want to create a form on my website to collect email addresses for a mailing list. I have successfully created the form using the following html code:

<form method="post" action="formprocess.php">
E-mail Address: <input type="text" name="email"><p>
<input type="submit" name="submit" value="Submit">
</form>

I also have a file called formprocess.php with the following code:

<?php
$to = "myemail@mysite.com";
$subject = "Someone's email address from web form";
$email = $_POST['email'];
$message = "Person's email address: $email\n";
$headers = "From: $email";
$ok = @mail($to, $subject, $message, $headers);
if ($ok) {
include("success.html");
} else {
include("fail.html");
};
?>

Lastly, I have created the success.html and fail.html pages. These two files and the file with the form and the formprocess.php file all sit in the same directory.

I'm able to get the web form for the email address and the "Submit" button to appear, but I can't seem to get the php script to run. When I press "Submit", the browser returns a blank page.

You can see this result at http://www.goler.com/yorz

Also, I tried action="formprocess.php" and action="/yorz/formprocess.php" in hopes that maybe the submit wasn't finding the php file. That change didn't help. I called my hosting company (fatcow.com) and they assure me that php is installed on their boxes. The tech support person thought I might have a problem with my "permissions". I'm unfamiliar what with what sort of permission issues I may be running into.

I would greatly appreciate it if anyone has any suggestions about what might be causing this problem and how I could fix it.

Thank you!

--g

Posted: Wed Aug 18, 2004 4:44 pm
by feyd
try adding this to the top of your formprocess script:

Code: Select all

ini_set('display_errors', '1');
error_reporting(E_ALL);
also, run a [php_man]phpinfo[/php_man]() call to make sure you are allowed to run the include function (look for "disabled functions")

Posted: Wed Aug 18, 2004 4:50 pm
by Brian3864
While I'm new to php, I'm not seeing a call to the mail() function.

Code: Select all

mail($to, $subject, $message, $headers);

Posted: Wed Aug 18, 2004 4:57 pm
by Brian3864
Nevermind, I see it now and it's working on my local machine here.

Posted: Wed Aug 18, 2004 4:57 pm
by tim
Brian3864 wrote:While I'm new to php, I'm not seeing a call to the mail() function.

Code: Select all

mail($to, $subject, $message, $headers);

you do not need to make a function work by "giving its own line", his set-up is fine.

It works!

Posted: Tue Aug 24, 2004 11:38 am
by ggordon
All,

Thanks for the advice. It's working now (http://www.yorz.com)! I was using textpad and Word to edit my html and I think the result was yielding invalid html that IE couldn't read. When I switched to Dreamweaver, the problem went away.

Thanks again.

Best,

-g