Jump to content


Photo

[SOLVED] mail help


  • Please log in to reply
5 replies to this topic

#1 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 14 April 2006 - 04:43 PM

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..

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 14 April 2006 - 05:26 PM

Can you post your script please?

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 14 April 2006 - 06:51 PM

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..

#4 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 14 April 2006 - 07:42 PM

<?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.
Think you're smarty?

(Gone until 20 to November)

#5 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 14 April 2006 - 08:47 PM

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 ..

#6 jcbarr

jcbarr
  • Members
  • PipPipPip
  • Advanced Member
  • 219 posts

Posted 14 April 2006 - 09:20 PM

Have your form pass a variable like this;

<input type="hidden" name="send" value="Y">

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

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

if ($send=="Y"){

place script here

    } ?>

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users