Click to See Complete Forum and Search --> : Email Form without Outlook


moondance
05-08-2003, 10:29 AM
This question has been asked on here before, but i need something slightly different.

I want to post this form. Nice and simple, nothing complex about it. I don't want outlook express to mail it though; i want it to be sent directly. I know that i need PHP to do this. But i DON'T want a reply or confirmation automatically sent back to the sender or anything like that, just to simply post it without using OExpress.

Heres my form:

<form action="MAILTO:poohead@poofarm.com" method="post" enctype="text/plain">
<p>Your Name: </p>
<input TYPE="text" NAME="persons-name" SIZE="40" MAXLENGTH="40">
<p>Subject: </p>
<input TYPE="text" NAME="persons-name" SIZE="40" MAXLENGTH="40">
<br>
<p>Comments: </p>
<textarea NAME="comments" ROWS="5" COLS="30"></textarea>
<br>
<center><input TYPE="submit" NAME="Request" VALUE=" Send "></center>
</form>

If anyone knows the PHP for this i'd appreciate it.

Any help will be rewarded in heaven. Remember - jesus loves you.

pyro
05-08-2003, 11:07 AM
Here is the PHP that I use for this:

<?PHP

#######################################################
# This script is Copyright 2003, Infinity Web Design #
# Written by Ryan Brill - ryan@infinitypages.com #
# All Rights Reserved - Do not remove this notice #
#######################################################

## The lines below need to be edited...

###################### Set up the following variables ######################
# #
$to = "you@your.com"; #set addres to send for to
$subject = "Results from your Request Info form"; #set the subject line
$headers = "From: Form Mailer"; #set the from address
$forward = 1; # redirect? 1 : yes || 0 : no
$location = "thankyou.htm"; #set page to redirect to, if 1 is above
# #
##################### No need to edit below this line ######################

## set up the time ##

$date = date ("l, F jS, Y");
$time = date ("h:i A");

## mail the message ##

$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo ("Thank you for submitting our form. We will get back to you as soon as possible.");
}

?>

moondance
05-08-2003, 11:15 AM
ok cheers i'll give that a try



:D

DaveSW
05-08-2003, 11:29 AM
Cool script pyro. Are there any corporate licences required? Or is it free provided the copyright stays in?

Dave

pyro
05-08-2003, 11:34 AM
Hmmm... corporate licencing, now there is an idea. ;) Seriously, go ahead and use it, just leave the copyright, and don't start passing it around like it's yours. :D

DaveSW
05-08-2003, 11:56 AM
Thanks super moderator!! :D

pyro
05-08-2003, 11:57 AM
No problem...

Cheers!

DaveSW
05-08-2003, 12:54 PM
I keep getting this error

Parse error: parse error in /homepages/40/d73801884/htdocs/form/phpmail.php on line 14

When I use the code as on this link.
http://www.emdevelopments.co.uk/form/form.htm
How exactly should I insert it (never used php before)? Should it be a .php file targeted in the form action, or pasted at the top of the page and saved (the html) as a .php file? If the second option, what is the form action?

dave

pyro
05-08-2003, 01:17 PM
Post the script that you are using (with your changes) Also, you just make a php page and then link to it with your forms action (first method)

DaveSW
05-08-2003, 01:23 PM
<?PHP


_##################################################

#####

# This script is Copyright 2003, Infinity Web Design__#

# Written by Ryan Brill - ryan@infinitypages.com______#

# All Rights Reserved - Do not remove this notice_____#

_##################################################

#####


## The lines below need to be edited...


###################### Set up the following variables ######################

#__________________________________________________________________________#

$to_=_"dave@999man.co.uk";_#set addres to send for to

$subject_=_"Results from your Request Info form";_#set the subject line

$headers_=_"Form Mailer";_#set the from address

$forward_=_1;_# redirect? 1 : yes || 0 : no

$location_=_"ta.htm";_#set page to redirect to, if 1 is above

#__________________________________________________________________________#

##################### No need to edit below this line ######################


## set up the time ##


$date_=_date_("l, F jS, Y");

$time_=_date_("h:i A");


## mail the message ##


$msg_=_"Below_is_the_result_of_your_feedback_form.__It_was_submitted__on_$date_at_$time.\n\n";

____

foreach_($_POST_as_$key_=>_$value)_{

____$msg_.=_ucfirst_($key)_." : "._$value_._"\n";

}


mail($to,_$subject,_$msg,_$headers);

if_($forward_==_1)_{

____header_("Location:$location");

}

else_{

____echo_("Thank you for submitting our form. We will get back to you as soon as possible.");

}


?>

DaveSW
05-08-2003, 01:24 PM
hey - where did all those lines come from?

Is it post or get?

Edit: Here's the html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE></TITLE>
</HEAD>
<BODY>
<DIV ALIGN="CENTER">
<FORM ACTION="phpmail.php" METHOD="POST">
<DIV>Name: <INPUT TYPE="TEXT" NAME="Name"></DIV>
<DIV>Company/Brigade: <INPUT TYPE="TEXT" NAME="Company"></DIV>
<DIV>Job Position: <INPUT TYPE="TEXT" NAME="Job"></DIV>
<DIV>Email: <INPUT TYPE="TEXT" NAME="Email"></DIV>
<P></P>
<DIV>Tick this box if you wish to receive more information on
Ironmongers sales<INPUT TYPE="CHECKBOX" NAME="IronmongerInfo"></DIV>
<DIV>Tick this box if you wish to receive more information on Fire
Equipment sales<INPUT TYPE="CHECKBOX" NAME="FireEquip"></DIV>
<DIV>Tick this box if you wish to receive more information on Conveyors
sales<INPUT TYPE="CHECKBOX" NAME="Conveyors"></DIV>
<P></P>
<DIV><INPUT TYPE="SUBMIT" NAME="Send" VALUE="Send"><INPUT TYPE="RESET"
NAME="Clear" VALUE="Clear"></DIV></FORM></DIV> </BODY>
</HTML>

pyro
05-08-2003, 02:02 PM
Alright... which line out of all that is line 14? If it is this one:

$forward = 1; # redirect? 1 : yes || 0 : no

try this instead:

$forward = "1"; # redirect? 1 : yes || 0 : no

DaveSW
05-08-2003, 02:41 PM
<?PHP


_##################################################

#####

# This script is Copyright 2003, Infinity Web Design__#

# Written by Ryan Brill - ryan@infinitypages.com______#

# All Rights Reserved - Do not remove this notice_____#

_##################################################

#####


## The lines below need to be edited...


###################### Set up the following variables ######################

#__________________________________________________________________________#

$to_=_"dave@999man.co.uk";_#set addres to send for to

$subject_=_"Results from your Request Info form";_#set the subject line

$headers_=_"Form Mailer";_#set the from address

$forward_=_"1";_# redirect? 1 : yes || 0 : no

$location_=_"ta.htm";_#set page to redirect to, if 1 is above

#__________________________________________________________________________#

##################### No need to edit below this line ######################


## set up the time ##


$date_=_date_("l, F jS, Y");

$time_=_date_("h:i A");


## mail the message ##


$msg_=_"Below_is_the_result_of_your_feedback_form.__It_was_submitted__on_$date_at_$time.\n\n";

____

foreach_($_POST_as_$key_=>_$value)_{

____$msg_.=_ucfirst_($key)_." : "._$value_._"\n";

}


mail($to,_$subject,_$msg,_$headers);

if_($forward_==_1)_{

____header_("Location:$location");

}

else_{

____echo_("Thank you for submitting our form. We will get back to you as soon as possible.");

}


?>

Like this? It doesn't work either :( my line 14 was a blank one! Must have miscounted!

pyro
05-08-2003, 05:54 PM
Hmm... why don't you try .zipping the file that you are using, so I can look at it/try it...

DaveSW
05-08-2003, 06:17 PM
Ok thanks a lot.

pyro
05-08-2003, 07:41 PM
I think the problem is the way you saved the file. What program did you use to do that? Anyway, here's my original script again... Try opening with notepad and making your changes in that... The reason I think this, is because I was able to move the error to the next line by simply deleting all the spaces that were there are re-adding them.

DaveSW
05-09-2003, 12:48 PM
That worked thanks. I used notepad, but it appeared diferently - the formatting must have been lost when it was posted on the forum.

Thanks o Super Moderator! :D

pyro
05-09-2003, 12:51 PM
Ok, I figured that was what it was... I was hoping that it wasn't one of the finicky things with my script... lol. Anyway, glad it's working for you!

Cheers!