Jump to content

[SOLVED] mail help


corillo181

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..
Link to comment
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..
Link to comment
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.
Link to comment
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 ..
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.