[SOLVED] potential permissions problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ggordon
Forum Newbie
Posts: 2
Joined: Wed Aug 18, 2004 4:17 pm

potential permissions problem

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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")
Brian3864
Forum Newbie
Posts: 9
Joined: Mon Aug 16, 2004 10:29 am

Post 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);
Brian3864
Forum Newbie
Posts: 9
Joined: Mon Aug 16, 2004 10:29 am

Post by Brian3864 »

Nevermind, I see it now and it's working on my local machine here.
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post 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.
ggordon
Forum Newbie
Posts: 2
Joined: Wed Aug 18, 2004 4:17 pm

It works!

Post 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
Post Reply