Problem with php form mailer

the mail() function

Moderators: macek, egami, gesf

webchef
New php-forum User
New php-forum User
Posts: 5
Joined: Tue Sep 17, 2002 12:52 am
Location: Bahrain
Contact:

Problem with php form mailer

Postby webchef » Tue Sep 17, 2002 12:56 am

Hello, and thanks in advance for any help.

My problem revolves on a three page process. The first page bieng the information page, in html. on this page there is a link to go to a form, where the user can fill out the form and get more info. The link itself posts the variable:

Code: Select all

<a href="email_form.php?page=business.html"><font face="Tahoma">Fill me out</font></a>


The next page is a php page. it contains the form. and only one line of php. The php code just places the $page variable in a hidden field:

Code: Select all

<input type="hidden" name="page" value="<?php echo " $page "; ?>">


The last page is where the problem really is. Before i go on, let me tell you that the problem is expierenced online. My local testing server runs the script fine. it works on my machine but not online.

The web server is IIS on Windows 2k (or nt?). My computer is running appache on Windows 2k.

The following is the php code on the last page:

Code: Select all

<?php
//Check to see if all the fields have been filled in and act.
if (!$name || !$emailadd || $interest == "Choose One") {
echo "
Not all required (*) fields were filled in. Please go back and try again.
";
}
else {
//Send Email
if(mail("mike@intragulf.com", "From page: $page, Intrested in bieng: $interest", "Name = $name\r\nCompany = $company\r\nPosition = $position\r\nLocation = $location\r\nTelephone = $telphone\r\nEmail Address = $emailadd\r\nFrom page = $page\r\nIntrested in bieng a Supplier, Customer, Both, or Neither: $interest\r\nComment = $comment\r\n")) {
echo "
E-mail sent. Thank you.
<BR> You are currently bieng redirected. If nothing happens
<a href=$page>click here</a>
";
}
else {
echo " E-mail was not sent. Please go back and try again. ";
}
}
?>


like i said. the code works on my machine.. but online i get this message when the form is submitted:

Warning: Failed to Receive in
E:\webrun\f1bahrain\pages\email_confirm.php on line 46
E-mail was not sent. Please go back and try again.


Please help. I can't figure out the problem.

Thanks
Mike

ps. if you want to see the pages in thier enviorment go to http://www.f1bahrain.com and click the top picture link "business development". you can actually go to any of the links (except for the last one, "local and international news") because each page links to the same form.[/code]

elitecodex
New php-forum User
New php-forum User
Posts: 68
Joined: Tue Jul 09, 2002 8:45 am
Location: East Coast, USA
Contact:

Postby elitecodex » Tue Sep 17, 2002 9:10 am

Maybe its an "auto_global" problem. I think this setting by default is on, and most webservers turn it off due to hazards. When you reference a variable from page to page (for instance, a text field or a hidden field), do not reference it by $field_name... you have to reference it by $_GET["field_name"] or $_POST["field_name"] (whichever the case may be).

Try that and see if it helps.

Will

webchef
New php-forum User
New php-forum User
Posts: 5
Joined: Tue Sep 17, 2002 12:52 am
Location: Bahrain
Contact:

Its not a variable problem

Postby webchef » Wed Sep 18, 2002 12:13 am

Thanks for the suggestion...

But its not a variable problem. The variables carry through just fine.

The problem is in the actual mail function. I solved the prolbem, i just had to specify the SMTP server in the php.ini file at the server. So now i no longer see the "failed to recieve" error message.

But another problem occured. i know see this message:

Warning: Failed to Connect in E:\webrun\f1bahrain\pages\email_confirm.php on line 46
E-mail was not sent. Please go back and try again.

im thinking its a header problem. So im gonna go and insert the headers, and see what happens.

webchef
New php-forum User
New php-forum User
Posts: 5
Joined: Tue Sep 17, 2002 12:52 am
Location: Bahrain
Contact:

Nothing seems to work.

Postby webchef » Wed Sep 18, 2002 12:43 am

Well i tried adding headers and such. And it still won't work.

So i went backand tried the

Code: Select all

$_post["variable"];
method and i ended up getting empty variables!..

im lost... i can't get this to work and its driving me insane.

elitecodex
New php-forum User
New php-forum User
Posts: 68
Joined: Tue Jul 09, 2002 8:45 am
Location: East Coast, USA
Contact:

Postby elitecodex » Wed Sep 18, 2002 3:15 am

hmmm....im not sure then, sorry :(

If your variables are coming through ok ( did you use a var_dump($_POST); to verify? ) then I dont see what else could be wrong. Perhaps one of the guru's has some suggestions :)
I checked the manual and they had a couple of comments regarding windows users. Might be worth your while to check it out (if you havent already)

sorry i couldnt help.

Will

webchef
New php-forum User
New php-forum User
Posts: 5
Joined: Tue Sep 17, 2002 12:52 am
Location: Bahrain
Contact:

Thank you

Postby webchef » Wed Sep 18, 2002 5:14 am

Its not my fault. The code works fine. The problem is at the server. boss decided to cut costs by having a local friend host the site. And they have problems with thier smtp server.

So its cool. i just deposit the info in the database rather than email it.

Oh well. Thanks for the help anyway.

Mike


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest

cron