Jump to content

Archived

This topic is now archived and is closed to further replies.

corillo181

[SOLVED] mail help

Recommended Posts

hi i'm new to php and i tried everything to do a form and recieve it in to my mail.. i fallow every tutorial on the net i could and still it dont work..

is there something my webhost provider most do so it can work? because i know is not me.. i tried all kind of tutorials and still i'm not able to recieve a mail from a form..

Share this post


Link to post
Share on other sites
i used the scribs from phpfreaks tutorials.. i did the biulding a membership sing up system.. . that one didn't work to send email and i fallowed every step back and forth.. i even did it a few times cuz i wanted to learn how to do it so i can do my own.. everytihng is fine i even get the member info in to my database , but they never get the email..

i also tried building a simple form..

in that one too the info goes in to the database, but can't send a email

how about you post a script that works and i can try it and tell you if it did work or if is something wrong with my server provider..



.. i really need this help this only thing holding me back to learning more about other things..


thank you for your help..

Share this post


Link to post
Share on other sites
<?php
$ip = getenv(REMOTE_ADDR);
$to = "you@host.com";
$subject = $_POST['subject'];
$body = "Name: ".$_POST['Name']." \n Rating: ".$_POST['Rating']." \n \n Comments: \n ".$_POST['Comments']." \n \n $ip";
mail($to,$subject,$body);
echo "Thank you ";
?>

For example.

Orio.

Share this post


Link to post
Share on other sites
oh that help.. i don't know what was wrong with the tutorials.. but this one work..

now the problem witht he form i attach is when the page is view it send a email empty.

i know i got to put some thing like if (isset['submit']) so the form is only sent when they press the submit bottum but i dunno how to put that ..

Share this post


Link to post
Share on other sites
Have your form pass a variable like this;

[code]<input type="hidden" name="send" value="Y">[/code]

Then make your script run depending on the value of the send variable;

[code]<? $send=$_POST['send'];

if ($send=="Y"){

place script here

    } ?>[/code]

I don't know if that is the best way to do it, but it has always worked for me.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.