Jump to content


Photo

Mail Form Help - simple (i think)


  • Please log in to reply
4 replies to this topic

#1 JoeMcClemont

JoeMcClemont
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 30 May 2006 - 12:19 PM

Hi - I was just wondering if anyone could tell me what I'm doing wrong. Because i'm on NTL i can't host php scripts - so i'm using a free host with PHP enabled. My form "action" takes me to [a href=\"http://usernameblabla.php1h.com/scripts/contact.php\" target=\"_blank\"]http://usernameblabla.php1h.com/scripts/contact.php[/a]. (thats not my site by the way- thats some wierd thing the host puts in if its a wrong url) I think that works (somone tell me if it obviously doesn't [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /] ) I think the problem is in the script itself :

<?php

// get posted data into local variables
$EmailFrom = ">>>>>>>>>!!!!!!WHAT HERE!!!!!!!!??????<<<<<<<<<";
$EmailTo = ">>>>>>>>>>MY EMAIL<<<<<<<<<<";
$Subject = "Submitted Link";
$LinkURL = Trim(stripslashes($_POST['LinkURL']));
$Description = Trim(stripslashes($_POST['Description']));

// validation
$validationOK=true;
if (Trim($LinkURL)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}

// prepare email body text
$Body = "";
$Body .= "LinkURL: ";
$Body .= $LinkURL;
$Body .= "\n";
$Body .= "Description: ";
$Body .= $Description;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>

I have no idea what to put in the EMAILFROM tag thingy. Can somone tell me what this tag thing does and if there are any nessassary things i have to put in it - like an email from the same sever or anything. I've tried loads of stuff but i think thats the reason why im not receiving - i havn't made the "ok.htm and error.htm" pages yet - could that be it? thanks

#2 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 30 May 2006 - 12:23 PM

email from should be the email address of the sender of the email.

ie you@yourdomain.com if you're sending the email to someone else, or sender@their-email-address.com if they're submitting the form to you.
wisewood: proven fact, I am both wise, and wooden.

#3 JoeMcClemont

JoeMcClemont
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 30 May 2006 - 12:57 PM

ok... so does that mean the person submitting has to enter their email address? im trying to just get 2 simple boxes and a submit button. URL: and DESCRIPTION: . do i have to have a box where the visitor has to enter his/her email to send it? what if i just put a different email account that i still own - like hotmail. ...

#4 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 30 May 2006 - 02:02 PM

If they're just sending an email to you, from your website, and you dont care who they are etc, just leave that detail blank.
wisewood: proven fact, I am both wise, and wooden.

#5 JoeMcClemont

JoeMcClemont
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 30 May 2006 - 05:18 PM

so... do i delete the whole line of code:
$EmailFrom = "email here";

or just do this:
$EmailFrom = "";




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users