Php form mailer help
I have this form that I got to work with my flash file. There
is part of the php that should send an acknowledgement email and it
seems to be not working. I am wondering if someone could explain
what I am missing.
I think I have everything working down to line 16. After
that, I think I understand what is going on, but might be missing
some things.
How can I use the echo and &Status to make sure in my
Flash file that the form actually got send?
Thanks a lot for any help!
It is all inside an ifStatment that is inside a function,
which gets called by the button that send the form. Here is the
full thing.
function validateForm(tName:String, tEmail:String,
tSubject:String, tMsg:String):Void {
trace("validateForm was called");
if (tName == "" || tName == undefined) {
trace("tName if");
this.showAlertMsg("Please enter your name");
} else if (tEmail == "" || tEmail == undefined ||
tEmail.indexOf("@") == -1 || tEmail.indexOf(".") == -1) {
trace("Invalid email address: "+tEmail+" infexOf1:
"+tEmail.indexOf("@")+" indexOf2: "+tEmail.indexOf("."));
this.showAlertMsg("Invalid email address");
} else if (tSubject == "" || tSubject == undefined) {
trace("tSubject if");
this.showAlertMsg("Please enter a subject");
} else if (tMsg == "" || tMsg == undefined) {
trace("tComments if");
this.showAlertMsg("Please enter some comments");
} else {
trace("the else was called...");
var send_lv = new LoadVars();
//send_lv.onLoad = ShowStatus;
//send_lv.EmailType = "Quote";
send_lv.Name = tName;
send_lv.FromEmail = tEmail;
send_lv.Subject = tSubject;
send_lv.Comments = tMsg;
send_lv.status = "";
send_lv.sendAndLoad("php/sendContact.php",result_lv,"Post");
this.showAlertMsg("Sending...");
var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
this.tf_showAlertMsg.text = "Thank you for sending us an
email";
} else {
this.tf_showAlertMsg.text = "Email did not go through";
function showAlertMsg(msg:String):Void {
this.tf_showAlertMsg.text = "";
this.tf_showAlertMsg.text = msg;
this.send_btn.onRelease = function() {
validateForm(tf_Name,tf_Email,tf_Subject,tf_Comments);
I tried the new way Dave posted and it still does not get the
echo from the form.
Thanks so much to both of you for the help!
Similar Messages
-
What is a good resource for pre-made PHP Form Mailer Scripts.
This is for use with a website hosted on GoDaddy.
My client has a few requirements that the GoDaddy script does
not offer (and the script I chose from GoDaddy is uneditable). I
know nothing about scripting but thought I could use a pre-made
script and modify it...is that crazy thinking on my part?
Here are the special requests from my client:
- They'd like to see the time the form was submitted in EST
(the GoDaddy script puts the time in military time in another time
zone in the subject line). Can this appear in the body of the email
as well as the subject line?
- They'd like the form to be sent to the person submitting it
as well as to their company
- They would like to be able to REPLY TO the email they
receive with the form submission and have it be addressed to the
person submitting the form. The current script has the email
addressed to themselves (the company) if they click REPLY TO, so
they are replying to themselves
- Although this has nothing to do with the Form Mailer script
as far as I can guess, they asked that the person filling out the
form be able to print it prior to submitting (in my opinion,
though, if i can have a copy of the submission sent to the
submitter, there's no reason for this). But if anyone knows how to
do this, please let me know.
- Finally, the client wants to know if each submission can
have a unique tracking number assigned to it.
Thank you all. Any feedback is appreciated.
RichardHi,
I can without any doubt recommend Forms 2 Go:
http://www.bebosoft.com/products/formstogo/index.php
Very easy to use and even someone like me who don't know a
lot of
programming, use it extensively.
Deon
"RichyZee" <[email protected]> wrote in
news:gcvkac$fcp$[email protected]:
> What is a good resource for pre-made PHP Form Mailer
Scripts. This is
> for use with a website hosted on GoDaddy.
>
> My client has a few requirements that the GoDaddy script
does not
> offer (and
> the script I chose from GoDaddy is uneditable). I know
nothing about
> scripting but thought I could use a pre-made script and
modify it...is
> that crazy thinking on my part?
>
> Here are the special requests from my client:
>
> - They'd like to see the time the form was submitted in
EST (the
> GoDaddy
> script puts the time in military time in another time
zone in the
> subject line). Can this appear in the body of the email
as well as the
> subject line?
>
> - They'd like the form to be sent to the person
submitting it as well
> as to
> their company
>
> - They would like to be able to REPLY TO the email they
receive with
> the form
> submission and have it be addressed to the person
submitting the form.
> The current script has the email addressed to themselves
(the company)
> if they click REPLY TO, so they are replying to
themselves
>
> - Although this has nothing to do with the Form Mailer
script as far
> as I can
> guess, they asked that the person filling out the form
be able to
> print it prior to submitting (in my opinion, though, if
i can have a
> copy of the submission sent to the submitter, there's no
reason for
> this). But if anyone knows how to do this, please let me
know.
>
> - Finally, the client wants to know if each submission
can have a
> unique
> tracking number assigned to it.
>
> Thank you all. Any feedback is appreciated.
>
> Richard
>
> -
Php form mailer/Flash help
I have a php form that I am using with my Flash file. It
works great so far, but I would like to get confirmation from the
php in the Flash file, that the info has really been sent. I think
it is already sent up in the php, but I don't know how to handle it
in my Flash file. The php file is attached. Do I use the echo? How
would I do that? What I want, is in my Flash file to say sending,
until I get then feedback from the php, and then say, sent
successfully.
Thanks a lot for any help!It is all inside an ifStatment that is inside a function,
which gets called by the button that send the form. Here is the
full thing.
function validateForm(tName:String, tEmail:String,
tSubject:String, tMsg:String):Void {
trace("validateForm was called");
if (tName == "" || tName == undefined) {
trace("tName if");
this.showAlertMsg("Please enter your name");
} else if (tEmail == "" || tEmail == undefined ||
tEmail.indexOf("@") == -1 || tEmail.indexOf(".") == -1) {
trace("Invalid email address: "+tEmail+" infexOf1:
"+tEmail.indexOf("@")+" indexOf2: "+tEmail.indexOf("."));
this.showAlertMsg("Invalid email address");
} else if (tSubject == "" || tSubject == undefined) {
trace("tSubject if");
this.showAlertMsg("Please enter a subject");
} else if (tMsg == "" || tMsg == undefined) {
trace("tComments if");
this.showAlertMsg("Please enter some comments");
} else {
trace("the else was called...");
var send_lv = new LoadVars();
//send_lv.onLoad = ShowStatus;
//send_lv.EmailType = "Quote";
send_lv.Name = tName;
send_lv.FromEmail = tEmail;
send_lv.Subject = tSubject;
send_lv.Comments = tMsg;
send_lv.status = "";
send_lv.sendAndLoad("php/sendContact.php",result_lv,"Post");
this.showAlertMsg("Sending...");
var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
this.tf_showAlertMsg.text = "Thank you for sending us an
email";
} else {
this.tf_showAlertMsg.text = "Email did not go through";
function showAlertMsg(msg:String):Void {
this.tf_showAlertMsg.text = "";
this.tf_showAlertMsg.text = msg;
this.send_btn.onRelease = function() {
validateForm(tf_Name,tf_Email,tf_Subject,tf_Comments);
I tried the new way Dave posted and it still does not get the
echo from the form.
Thanks so much to both of you for the help! -
I used this script
http://www.visibilityinherit.com/code/php-form-validation.php
to produce a form and everything worked fine on my site, which I
was using for testing. When I transferred over to the client's site
it doesn't send the email. The error and thank you messages work,
but no email. As I have heard that some hosts block some php files
with the name 'formmail' I called it something else.
I have checked and rechecked all the data and only my email
address and the URLs for the error and thank you pages had to be
changed, my email is correct, but still not email.
Any ideas as to what is happening and how I can get around it
please?
RosalindI have been sent the following information and code, but have
not succeeded in working out where to add it. The code I am using
is underneath. Many thanks
- to send emails through our servers you must comply with one
of the following rules
a. The sending email must be from your domain
b. The receiving email must be from your domain
This account could/should be [email protected]
- To avoid a wrong use of our scripts by spammers you must
had a line before you call the “mail” functionality
ini_set("sendmail_from", " [email protected] ");
- Please add to the email send code a functionality
“-f” in the fifth parameter of the function send mail
- This is the simple configuration of sending emails in php
<?php
ini_set("sendmail_from", [email protected]);
mail($email_to, $email_subject, $email_message, $headers,
'-f'[email protected]);
?>
my php code is
<?php
// Input Your Personal Information Here
$mailto = '[email protected]' ;
$from = "FormosaParadise.com" ;
$formurl = "
http://formosaparadise.com/correios.php"
$errorurl = "
http://formosaparadise.com/formmailerror.php"
$thankyouurl = "
http://formosaparadise.com/thankyou.php"
// End Edit
// prevent browser cache
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "
GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
function remove_headers($string) {
$headers = array(
"/to\:/i",
"/from\:/i",
"/bcc\:/i",
"/cc\:/i",
"/Content\-Transfer\-Encoding\:/i",
"/Content\-Type\:/i",
"/Mime\-Version\:/i"
if (preg_replace($headers, '', $string) == $string) {
return $string;
} else {
die('You think Im spammy? Spammy how? Spammy like a clown,
spammy?');
$uself = 0;
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" :
"\n" ;
if (!isset($_POST['email'])) {
header( "Location: $errorurl" );
exit ;
// Input Your Personal Information Here
$name = remove_headers($_POST['name']);
$email = remove_headers($_POST['email']);
$phone = remove_headers($_POST['phone']);
$comments = remove_headers($_POST['comments']);
$http_referrer = getenv( "HTTP_REFERER" );
// End Edit
if
(!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i",$email))
header( "Location: $errorurl" );
exit ;
// Input Your Personal Information Here
if (empty($name) || empty($email) || empty($phone)
||empty($comments)) {
header( "Location: $errorurl" );
exit ;
// End Edit
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
// sets max amount of characters in comments area (edit as
nesesary)
if (strlen($comments) > 1250) {
$comments=substr($comments, 0, 1250).'...';
// End Edit
$message =
"This message was sent from:\n" .
"$http_referrer\n\n" .
// Input Your Personal Information Here
"Name: $name\n\n" .
"Email: $email\n\n" .
"Phone No: $phone\n\n" .
"Comments: $comments\n\n" .
"\n\n------------------------------------------------------------\n"
// End Edit
mail($mailto, $from, $message,
"From: \"$name\" <$email>" . $headersep . "Reply-To:
\"$name\" <$email>" . $headersep );
header( "Location: $thankyouurl" );
exit ;
?> -
i'm creating an inquiry form for a client hosting w/godaddy.
Site is in DW using godaddy's php form mail script. script
works fine for sending formmail.
Is it possible to validate form fields in php? the customer
wants to have the first name, email address, etc. being a required
field or the form will not submit. godaddy support is clueless,
they e-mailed a kb article on changing the form e-mail address as a
solution.
can anyone provide insight? thanx in advance!Sure it is. It's even possible to do it in javascript before
the form gets
submitted.
Which DW are you using?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"donna_d" <[email protected]> wrote in
message
news:fn8468$r4n$[email protected]..
> i'm creating an inquiry form for a client hosting
w/godaddy.
> Site is in DW using godaddy's php form mail script.
script works fine for
> sending formmail.
>
> Is it possible to validate form fields in php? the
customer wants to have
> the
> first name, email address, etc. being a required field
or the form will
> not
> submit. godaddy support is clueless, they e-mailed a kb
article on
> changing
> the form e-mail address as a solution.
>
> can anyone provide insight? thanx in advance!
> -
Hello Everyone,
I am starting to learn Flash and created a form mailer for a website I am working on. The following code is what I have in AS3.0 and it all loads fine in the web browser, but I do not receive the email with the info.
var address:String = "gdform.php";
var url:URLRequest;
var variables:URLVariables = new URLVariables ();
variables.subject = "New Fighter Profile";
submit_btn.addEventListener(MouseEvent.CLICK,sendForm);
function sendForm(event:MouseEvent):void{
variables.FirstName = firstname_txt.text;
variables.LastName = lastname_txt.text;
variables.Birthdate = birthdate_txt.text;
variables.Nickname = nickname_txt.text;
variables.HeightFt = hft_txt.text;
variables.HeightIn = hin_txt.text;
variables.Weightclass = weightclass_txt.text;
variables.RecWins = wins_txt.text;
variables.RecWins = losses_txt.text;
variables.Debut = debut_txt.text;
variables.Hometown = hometown_txt.text;
variables.FightClub = fightclub_txt.text;
variables.Styles = styles_txt.text;
variables.Email = email_txt.text;
variables.Bio = bio_txt.text;
url = new URLRequest (address);
url.method = URLRequestMethod.POST;
url.data = variables;
navigateToURL (url);
var reqThanks:URLRequest=new URLRequest("thanks.html");
navigateToURL(reqThanks,"_blank");
var reqHome:URLRequest=new URLRequest("index.html");
navigateToURL(reqHome,"_parent");
Please Help!
Thanks,
JohnMaybe someone here can help.
In spite of the site name, it is a Mac video card site. -
Need help with PHP form with checkboxes, radio buttons and file attachment
Hi guys,
I'm having a nightmare with this PHP form where a user can fill it in, attach a doc/pdf and submit. After trying to sort it out with previous code I've used, I've stripped it out and think I should just start again in the hope you geniuses can help!
Here is the HTML of contact.php:
<form action="" method="post" name="contact" id="contact">
<p>Job Title:*<br />
<input name="position" type="text" /></p>
<p>Nationality:*<br />
<select name="nationality">
<option value="">-- select one --</option>
<option value="Afghan">Afghan</option>
<option value="Albanian">Albanian</option>
<option value="Algerian">Algerian</option>
<option value="Zambian">Zambian</option>
<option value="Zimbabwean">Zimbabwean</option>
</select>
</p>
<p>Which country are you currently living in?*<br />
<select name="country">
<option value="">-- select one --</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Afghanistan">Afghanistan</option>
<option value="Africa">Africa</option>
<option value="Zambia">Zambia</option>
<option value="Zimbabwe">Zimbabwe</option>
</select>
</p>
<label class="radio" for="checkRight">Yes/No question?</label><br />
<input class="radio" type="radio" name="right" value="Yes" /> Yes
<input class="radio" type="radio" name="right" value="No" /> No
<input class="radio" type="radio" name="right" value="N/A" /> Not applicable
<p>Yes/No question?<br />
<select name="continue">
<option value="">-- select one --</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</p>
<p>Select your resorts:<br />
Resort 1<input name="res1" type="checkbox" value="Resort 1" />
Resort 2<input name="res2" type="checkbox" value="Resort 2" />
Resort 3<input name="res3" type="checkbox" value="Resort 3" />
Resort 4<input name="res4" type="checkbox" value="Resort 4" />
Resort 5<input name="res5" type="checkbox" value="Resort 5" />
Resort 6<input name="res6" type="checkbox" value="Resort 6" />
</p>
<p>Don't send form unless this is checked:* <input type="checkbox" name="parttime" value="Yes" /></p>
<p>Date of arrival: <input name="arrive" id="datepick" /><br />
Date of departure: <input name="depart" id="datepick2" /></p>
<script type="text/javascript" src="assets/scripts/datepickr/datepickr.js"></script>
<link href="assets/scripts/datepickr/datepickr.css" rel="stylesheet">
<script type="text/javascript">
new datepickr('datepick');
new datepickr('datepick2', {
</script>
<p>Name:*<br />
<input name="name" type="text" /></p>
<p>E-mail:*<br />
<input name="email" type="text" /></p>
<p>Telephone:*<br />
<input name="telephone" type="text" class="ctextField" /></p>
<p>Upload CV (Word of PDF formats only):<br />
<input type="file" name="cv" class="textfield"></p>
<p><input name="submit" value="Submit Enquiry" class="submitButton" type="submit" /><div style="visibility:hidden; width:1px; height:1px"><input name="url" type="text" size="45" id="url" /></div></p>
</form>
By the way, the date boxes work so excuse the Javascript in there!
To prevent SPAM I've used a trick where there's a hidden URL field which must be left blank for the form to submit which you can see in the PHP.
Below is where I'm at with the PHP which is placed above the header of contact.php...
<?php
if (array_key_exists('submit', $_POST)) {
$position = $_POST['position'];
$arrive = $_POST['arrive'];
$nationality = $_POST['nationality'];
$parttime = $_POST['parttime'];
$depart = $_POST['depart'];
$name = $_POST['name'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$to = "[email protected]";
$subject = "Recruitment Application";
$message = $headers;
$message .= "Name: " . $_POST["name"] . "\r\n";
$message .= "E-mail: " . $_POST["email"] . "\r\n";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= 'From: My Website <[email protected]>' . "\r\n";
$message= "
$url = stripslashes($_POST["url"]);
if (!empty($url)) {
header( 'Location: http://www.go-away-spam-robots.com' );
exit();
if (!isset($warning)) {
mail($to, $subject, $message, $headers);
header( 'Location: http://www.mywebsite.co.uk/sent.php' );
?>
I would like to make pretty much all the field compulsory so if a field is left empty (other than the hidden URL field), a warning message is displayed next to that field.
Also I would like the file upload field to attach to the email that is sent to me and have the results come through to me in a table format.
Can anyone help me get my form working?
Thank you and I hope to hear from you!
SMHi Nancy,
Great stuff, thank you for the reply.
I've managed to get the Formm@iler working and running as I need it to.
The only thing I'm struggling with is when the user clicks submit, they are taken to a page of whatever results the form returned but it is just a white background with Times New Roman text.
How can I have it so the user is taken to the form results in the websites' page layout?
I tried sending them to a generic 'thank you' page by adding the following code but it just took them there whatever the results of the form so that's no good...! I have a feeling it's a bit more complicated than that...
header( 'Location: http://www.nofussbus.co.uk/test/sent.php' );
Thank you for your help! -
I just developed a simple php form (my first time). I am
trying to enable the information that is typed in the form by
visitors, to be emailed directly to me. So far I can only get the
person's email address and message left in information box to be
sent to my email address. However, there are other contents within
the form that I also need to receive. Can anyone help.
http://www.newnie.com/informationform.php
http://www.newnie.com/handle_form.phpOn 18 Oct 2007 in macromedia.dreamweaver.appdev, CellaMarr
wrote:
> When I fill out the form and press send the only
information that I
> receive is the "First Name", "Email Address", and
"Project Details".
> All the other info does not show up. Why will it only
send some of
> the information and not all of it? ("Phone Number",
"Profession",
> "Budget", "Hosting", and "Domain")
Because you're not telling it to send them to you. Consider:
$success = mail($to, $subject, $detail, $headers);
This line is correct and sends the email as it should. You're
telling
it that you want $detail as the body of the message. However,
when you
load variables:
$name = $_POST['name'];
$email = $_POST['email'];
$number = $_POST['number'];
$detail = $_POST['detail'];
$profession = $_POST['profession'];
$entertainer = $_POST['entertainer'];
$domain = $_POST['domain'];
$hosting = $_POST['hosting'];
$subject = 'Message from newnie.com'; // this is the subject
line. you
can make this say whatever you want
$headers = "From: $name <$email>\n";
$headers .= "Reply-To: $name <$email>\n";
$to = '[email protected]'; //change this to your email
you're only putting the contents of the 'detail' form field
into
$detail. You need to do something more like:
$body = 'Name: ' . $_POST['name'] . "\n";
$body .= 'EMail: ' . $_POST['email'] . "\n";
$body .= 'Number: " . $_POST['number'] "\n";
// etc
$subject = 'Message from newnie.com'; // this is the subject
line. you
can make this say whatever you want
$headers = "From: $name <$email>\n";
$headers .= "Reply-To: $name <$email>\n";
And your mail() statement becomes:
$success = mail($to, $subject, $body, $headers);
Joe Makowiec
http://makowiec.net/
Email:
http://makowiec.net/contact.php -
I am trying to create a php form and I can get it to spit out the information from the form but I cannot seem to get it to send the result as an email.
This is probably something really simple and I am totally missing it.
Here is the form:
<form method="post" action="sendail.php">
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
<p>I need:<span class="redStar">*</span>
<input type= "radio" name = "need" value = "service" />service.
<input type= "radio" name = "need" value = "sales" />to contact a salesperson.
<input type= "radio" name = "need" value = "literature" />to have literature sent to me.<br />
Name: <input type = "text" name = "name" size = "30" />
<span class="redStar">*</span><br />
Title: <input type = "text" name = "title" size = "30" /><br />
Company: <input type = "text" name = "company" size = "30" /></p>
<p>Address 1: <input type = "text" name = "address1" size = "30" />
<span class="redStar">*</span><br />
Address 2: <input type = "text" name = "address2" size = "30" /><br />
City: <input type = "text" name = "city" size = "30" />
<span class="redStar">*</span> State: <input type = "text" name = "state" size = "3" />
<span class="redStar">*</span> Zip: <input type = "text" name = "zip" size = "11" />
<span class="redStar">*</span></p>
<p>Email: <input type = "text" name = "email" size = "30" />
<span class="redStar">*</span><br />
Phone: <input type = "text" name = "phone" size = "30" />
<span class="redStar">*</span> </p>
<p><input type = "submit" name = "submit" value = "Submit" /></p>
<p><span class="redStar">*</span> These blanks must be filled in</p>
</form>
and here is the page that handles the form (with the exception of the referring page, and other environmentals:
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$need = $_POST['need'];
$name = $_POST['name'];
$title = $_POST['title'];
$company = $_POST['company'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$email = $_POST['email'];
$phone = $_POST['phone'];
if(!$email == "" && (!strstr($email,"@") || !strstr($email,".")))
echo "<h2>Use Back - Enter valid email</h2>\n";
$badinput = "<h2>Your form was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
if(empty($name) || empty($email) || empty($address1) || empty($city) || empty($state) || empty($zip) || empty($phone)) {
echo "<h2>Use your Back button - fill in all starred fields, your form was not submitted.</h2>\n";
die ("Use back! ! ");
$todayis = date("l, F j, Y, g:i a") ;
$subject = Contact_From_Website;
$message = " $todayis [EST] \n
From: $name ($email)\n
Title: $title\n
Company: $company\n
Telephone: $phone ($phone)\n
Address: $address1\n
$address2\n
City: $city\n
State: $state\n
Zip: $zip\n
Phone: $phone\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
$from = "From: $email\r\n";
mail("[email protected]", $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
/* This is the part that emails everyone and is commented out for testing
if ($need = "service") {
mail("[email protected]", $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
if ($need = "sales") {
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
if ($need = "literature") {
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
mail("[email protected]", $need, $name, $title, $company, $phone, $address1, $address2, $city, $state, $zip, $email, $phone, $ip, $httpref);
?>
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $name ?> ( <?php echo $email ?> ) <?php echo $title ?> <?php echo $company ?> <?php echo $phone ?> <?php echo $address1 ?> <?php echo $address2 ?> <?php echo $city ?> <?php echo $state ?> <?php echo $zip ?>
<br /> You have requested <?php echo $need ?>
<br /> Your IP Address has been recorded for your safety.
<?php echo $ip ?>
You can see where I am trying to go with this. I want to use the $need variable to determine where the email is going to go (two people in each case). But I am testing this script and cannot get to send me an email without any if statements.
Where have I gone wrong?60251977 wrote:
> I'm considering switching to Wordpress but have started
building a site in
> Dreamweaver, and am not especially keen on having to
learn an entirely new
> program.
If you're not keen on learning, you might want to reconsider
your plans.
Creating a simple web page is easy, giving many beginners the
false
impression that website development is something anyone can
do without
acquiring specialist knowledge.
> I want to create a simple "Add Comment" form so that
when a visitor to my site
> wants to comment, he can do so, press submit, and the
page refreshes with his
> comments inserted. Just like a blog.
Yep, sounds simple enough, but so is turning the ignition key
of a car.
What you're ignoring is the underlying technology that not
only makes it
work, but makes it work safely. WordPress does all of this
for you
straight out of the box. To build it successfully in
Dreamweaver
requires a knowledge of PHP, MySQL, and SQL.
> According to the Pickaweb FAQ, the path to PHP is
"/usr/bin/php"
If PHP is enabled on your site, the path to PHP is
irrelevant.
> If my site was called elephantlike.co.uk, what would I
enter into the Action
> field of the form wizard?
> Would this make my form work? Or is there other stuff I
need to know?
What you enter in the Action field is the path to the script
that
processes the form input. If you're willing to learn the
basics of PHP,
MySQL, and SQL, you can create a comment form on your site
with
Dreamweaver. However, you need to be aware of security
issues, such as
cross-site scripting and dealing with spam. What looks simple
at first
glance is actually more complex. It's not rocket science, but
it does
involve a learning curve.
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS4",
"PHP Solutions" & "PHP Object-Oriented Solutions"
http://foundationphp.com/ -
Help with ASP form mail code PLEASE
Hello
I am SOOooo close to this form mail code working correctly.
It is correctly sending the forms info to the form owner via
an email.
The only problem is it also sends an email as soon as the
page spawns and before the form is filled out. (with just the
labels of course)
Could someone PLEASE take a look and tell me specifically
what to change? Trying to woo the boss!
Thank you.
(I included the code for the form mail only....let me know if
I need to post the code for the whole ASP doc)See: http://developers.sun.com/techtopics/mobility/midp/articles/midp2network/
-
My PHP form no longer works?
Hi
http://www.collegestudentvoice.com/form/form.php
1. Programmer says there is no coding errors. Nothing has changed.
2. Host says there must be coding errors.
3. There may version incompetibilities with Perl script between the form and the host version.
these are 3 files:
Sendform:
<?php
// Pear library includes
// You should have the pear lib installed
include_once('Mail.php');
include_once('Mail/mime.php');
//Settings
$max_allowed_file_size = 10000000; // size in KB
$allowed_extensions = array("jpg", "jpeg", "gif", "bmp");
$upload_folder = 'files/'; //<-- this folder must be writeable by the script
$your_email = '[email protected]';//<<-- update this to your email address
$errors ='';
if(isset($_POST['submit']))
//Get the uploaded file information
$name_of_uploaded_file = basename($_FILES['uploaded_file']['name']);
//get the file extension of the file
$type_of_uploaded_file = substr($name_of_uploaded_file,
strrpos($name_of_uploaded_file, '.') + 1);
$size_of_uploaded_file = $_FILES["uploaded_file"]["size"]/1024;
///------------Do Validations-------------
if(empty($_POST['name'])||empty($_POST['email']))
$errors .= "\n Name and Email are required fields. ";
if(IsInjected($visitor_email))
$errors .= "\n Bad email value!";
if($size_of_uploaded_file > $max_allowed_file_size )
$errors .= "\n Size of file should be less than $max_allowed_file_size";
//------ Validate the file extension -----
$allowed_ext = false;
for($i=0; $i<sizeof($allowed_extensions); $i++)
if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)
$allowed_ext = true;
if(!$allowed_ext)
$errors .= "\n The uploaded file is not supported file type. ".
" Only the following file types are supported: ".implode(',',$allowed_extensions);
//send the email
if(empty($errors))
//copy the temp. uploaded file to uploads folder
$path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;
$tmp_path = $_FILES["uploaded_file"]["tmp_name"];
if(is_uploaded_file($tmp_path))
if(!copy($tmp_path,$path_of_uploaded_file))
$errors .= '\n error while copying the uploaded file';
//send the email
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$user_message = $_POST['message'];
$to = $your_email;
$subject="New form submission";
$from = $your_email;
$text = "A user $name has sent you this message:\n $user_message";
$message = new Mail_mime();
$message->setTXTBody($text);
$message->addAttachment($path_of_uploaded_file);
$body = $message->get();
$extraheaders = array("From"=>$from, "Subject"=>$subject,"Reply-To"=>$visitor_email);
$headers = $message->headers($extraheaders);
$mail = Mail::factory("mail");
$mail->send($to, $headers, $body);
//redirect to 'thank-you page
header('Location: thank-you.html');
///////////////////////////Functions/////////////////
// Function to validate against any email injection attempts
function IsInjected($str)
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str))
return true;
else
return false;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>File upload form</title>
<!-- define some style elements-->
<style>
label,a, body
font-family : Arial, Helvetica, sans-serif;
font-size : 12px;
</style>
<!-- a helper script for vaidating the form-->
<script language="JavaScript" src="scripts/gen_validatorv31.js" type="text/javascript"></script>
</head>
<body>
<?php
if(!empty($errors))
echo nl2br($errors);
?>
<form method="POST" name="email_form_with_php"
action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" enctype="multipart/form-data">
<p>
<label for='name'>Name: </label><br>
<input type="text" name="name" >
</p>
<p>
<label for='email'>Email: </label><br>
<input type="text" name="email" >
</p>
<p>
<label for='message'>Message:</label> <br>
<textarea name="message"></textarea>
</p>
<p>
<label for='uploaded_file'>Select A File To Upload:</label> <br>
<input type="file" name="uploaded_file">
</p>
<input type="submit" value="Submit" name='submit'>
</form>
<script language="JavaScript">
// Code for validating the form
// Visit http://www.javascript-coder.com/html-form/javascript-form-validation.phtml
// for details
var frmvalidator = new Validator("email_form_with_php");
frmvalidator.addValidation("name","req","Please provide your name");
frmvalidator.addValidation("email","req","Please provide your email");
frmvalidator.addValidation("email","email","Please enter a valid email address");
</script>
<noscript>
<small><a href='http://www.html-form-guide.com/email-form/php-email-form-attachment.html'
>How to attach file to email in PHP</a> article page.</small>
</noscript>
</body>
</html>
FORM:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>College Student</title>
<link rel="stylesheet" type="text/css" href="css/view.css" media="all">
<script type="text/javascript" src="js/view.js"></script>
<script src="js/forms.js" type="text/javascript"></script>
</head>
<body id="main_body" >
<div id="form_container">
<form action="formaction.php" method="post" enctype="multipart/form-data" name="contactus" id="contactus" style="border:none;" onsubmit="return validateForm()">
<div class="form_description">
<h2><img src="CSVlogo.GIF" width="269" height="97" alt="Logo" /></h2>
<p>Please type in your first and last names along with our school email address (i.e., [email protected]) when submitting your articles or photographs.</p>
<p>Select the category that best describes the subject of your article or photograph. (i.e., Business, Politics, Sports, Humor, etc.)</p>
<p>When writing about a sporting event please include the name of the sport in the ‘Subject’ line of your email along with the date of the event and the names of the teams. (i.e., Basketball 01-15-11 L.A. Lakers vs.Detroit Pistons)</p>
</div>
<div>
<?php
if (isset($_GET['suc'])) {
echo "<div style='color:#F00; padding:15px; display:block; margin:10px 0 10px 0;'> ";
echo "Thank you for your submission!";
echo "</div>";
} else {
?>
</div>
<ul >
<li id="li_5" >
<label class="description" for="Business">Business </label>
<div>
<select class="element select medium" name="Business">
<option value="" selected="selected"></option>
<option value="Classified" >Classified</option>
<option value="careertips" >Career Tip</option>
</select>
</div>
</li> <li id="li_6" >
<label class="description" for="ProfessionalSports">Professional Sports </label>
<div>
<select class="element select medium" name="ProfessionalSports">
<option value="" selected="selected"></option>
<option value="NBA" >NBA</option>
<option value="NFL" >NFL</option>
<option value="MLB" >MLB</option>
<option value="otherprosports" >Other</option>
</select>
</div>
</li> <li id="li_7" >
<label class="description" for="Humor101">Humor 101</label>
<div>
<select class="element select medium" name="Humor101">
<option value="" selected="selected"></option>
<option value="Cartoons" >Cartoons</option>
<option value="Jokes" >Jokes</option>
<option value="Stories" >Stories</option>
<option value="Photographs" >Photographs</option>
</select>
</div>
</li> <li id="li_8" >
<label class="description" for="CollegeSports">College Sports</label>
<div>
<select class="element select medium" name="CollegeSports">
<option value="" selected="selected"></option>
<option value="basketballcollege" >Basketball</option>
<option value="baseballcollege" >Baseball</option>
<option value="Footballcollege" >Football</option>
<option value="Softball" >Softball</option>
<option value="othercollege" >Other</option>
</select>
</div>
</li> <li id="li_9" >
<label class="description" for="Politics">Politics</label>
<div>
<select class="element select medium" name="Politics">
<option value="" selected="selected"></option>
<option value="statelocal" >State/Local</option>
<option value="National" >National</option>
<option value="World" >World</option>
</select>
</div>
</li> <li id="li_1" >
<label class="description" for="element_1">Name </label>
<span>
<input id="First" name="First" class="element text" maxlength="255" size="40" value=""/>
<label>First</label>
</span>
<span>
<input id="Last" name= "Last" class="element text" maxlength="255" size="40" value=""/>
<label>Last</label>
</span>
</li>
<li id="li_sub" >
<label class="description" for="Subject">Subject </label>
<div>
<input id="Subject" name="Subject" class="element text medium required" type="text" maxlength="255" value=""/>
</div>
</li>
<li id="li_2" >
<label class="description" for="Email">Email </label>
<div>
<input id="Email" name="Email" class="element text medium required email" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_3" >
<label class="description" for="EmailC">Confirm Email </label>
<div>
<input id="EmailC" name="EmailC" class="element text medium" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_4" >
<label class="description" for="Suggestions">Suggestions </label>
<div>
<textarea id="Suggestions" name="Suggestions" class="element textarea medium"></textarea>
</div>
</li>
<li id="li_5" >
<label class="description" for="Upload">Upload File </label>
<input type="file" name="uploaded_file">
<div>
</div>
</li>
<li id="li_6" >
<label class="description" for="Upload">Are you human?</label>
<?php
require_once('recaptchalib.php');
$publickey = "6LfwwsISAAAAAA7UTKJcDATLiK-e55gPFW1Opfrq"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<div>
</div>
</li>
<li class="buttons">
<input type="submit" name="Submit" value="Submit" class="button" />
</li>
</ul>
</form>
<!-- <div id="footer">
</div>
--> </div>
</body>
</html>
FORMACTION
<?php
require_once('recaptchalib.php');
$privatekey = "6LfwwsISAAAAAAPShkJ6nV3qkgLDHCe2uXj9RTWw";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
else {
include_once('Mail.php');
include_once('Mail/mime.php');
$errors ='';
$max_allowed_file_size = 10000000; // size in KB
$allowed_extensions = array("jpg", "jpeg", "gif", "bmp");
$upload_folder = 'files/';
$name_of_uploaded_file = basename($_FILES['uploaded_file']['name']);
$type_of_uploaded_file = substr($name_of_uploaded_file,
strrpos($name_of_uploaded_file, '.') + 1);
$size_of_uploaded_file = $_FILES["uploaded_file"]["size"]/1024;
if($size_of_uploaded_file > $max_allowed_file_size )
$errors .= "\n Size of file should be less than $max_allowed_file_size";
$allowed_ext = false;
for($i=0; $i<sizeof($allowed_extensions); $i++)
if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)
$allowed_ext = true;
if(!$allowed_ext)
$errors .= "\n The uploaded file is not supported file type. ".
" Only the following file types are supported: ".implode(',',$allowed_extensions);
if(empty($errors))
$path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;
$tmp_path = $_FILES["uploaded_file"]["tmp_name"];
if(is_uploaded_file($tmp_path))
if(!copy($tmp_path,$path_of_uploaded_file))
$errors .= '\n error while copying the uploaded file';
$Business = Trim(stripslashes($_POST['Business']));
$ProfessionalSports = Trim(stripslashes($_POST['ProfessionalSports']));
$Humor101 = Trim(stripslashes($_POST['Humor101']));
$CollegeSports = Trim(stripslashes($_POST['CollegeSports']));
$Politics = Trim(stripslashes($_POST['Politics']));
$EmailToBusiness = $Business . "@collegestudentvoice.net";
$EmailToProfessionalSports = $ProfessionalSports . "@collegestudentvoice.net";
$EmailToHumor101 = $Humor101 ."@collegestudentvoice.net";
$EmailToCollegeSports = $CollegeSports . "@collegestudentvoice.net";
$EmailToPolitics = $Politics . "@collegestudentvoice.net";
$EmailTo = "[email protected]";
$EMailSubject = Trim(stripslashes($_POST['Subject']));
$First = Trim(stripslashes($_POST['First']));
$Last = Trim(stripslashes($_POST['Last']));
$Email = Trim(stripslashes($_POST['Email']));
$Suggestions = Trim(stripslashes($_POST['Suggestions']));
$Body = "The following form has been filled";
$Body .= "\n";
$Body .= "---------------------------------------------------------------------------------";
$Body .= "\n";
$Body .= "\n";
$Body .= "First Name: ";
$Body .= $First;
$Body .= "\n";
$Body .= "Last Name: ";
$Body .= $Last;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Business: ";
$Body .= $Business;
$Body .= "\n";
$Body .= "Professional Sports: ";
$Body .= $ProfessionalSports;
$Body .= "\n";
$Body .= "Humor 101: ";
$Body .= $Humor101;
$Body .= "\n";
$Body .= "College Sports: ";
$Body .= $CollegeSports;
$Body .= "\n";
$Body .= "Politics: ";
$Body .= $Politics;
$Body .= "\n";
$Body .= "Suggestions: ";
$Body .= $Suggestions;
$Body .= "\n";
$Body .= "\n";
$Body .= "---------------------------------------------------------------------------------\n";
$Body .= "Emails sent to: " . strtolower($EmailToBusiness) . " / " .strtolower($EmailToProfessionalSports). " / " .strtolower($EmailToHumor101). " / " .strtolower($EmailToCollegeSports). " / ".strtolower($EmailToPolitics). "";
$to = "[email protected]";
$subject= $EMailSubject;
$from = "[email protected]";
$text = "\n $Body";
$message = new Mail_mime();
$message->setTXTBody($text);
$message->addAttachment($path_of_uploaded_file);
$body = $message->get();
$extraheaders = array("From"=>$from, "Subject"=>$subject,"Reply-To"=>$Email);
$headers = $message->headers($extraheaders);
$mail = Mail::factory("mail");
$mail->send($to, $headers, $body);
if ($Business != "")
$mail->send(strtolower($EmailToBusiness), $headers, $body);
if ($ProfessionalSports != "")
$mail->send(strtolower($EmailToProfessionalSports), $headers, $body);
if ($Humor101 != "")
$mail->send(strtolower($EmailToHumor101), $headers, $body);
if ($CollegeSports != "")
$mail->send(strtolower($EmailToCollegeSports), $headers, $body);
if ($Politics != "")
$mail->send(strtolower($EmailToPolitics), $headers, $body);
print "<meta http-equiv=\"refresh\" content=\"0;URL=form.php?suc=y\">";
?>bregent,
you have explained everything was is happening.
Mine firewall setttings block the scrip so when I fill the form and submit it, I do not get any errors, but that form information does not go anywhere.
All firewall setting should be OFF when a form is submitted?
dreamweavewr101.1 -
Need to add senders email address into the subject header of my PHP form (somehow)
Hello one and all,
I have a PHP form which is working fine and sends our support team an email with the subject header 'Support'.
I have been asked to fix this form to include the senders email address into the Subject header so that the support team can filter them easier and reply quicker.
Any help would be very much appreciated indeed. The form code is below, let me know if you need the whole page.
Thanks in advance,
Bradley
My current form PHP part looks like this: (and the HTML part is below in blue)
<?php
if($_GET["action"] == "email")
$msg = "The following person need support:\n\n";
$msg = $msg . "First Name: " . $_POST["FirstName"] . " " . $_POST["LastName"] . "\n";
$msg = $msg . "Tel: " . $_POST["Tel"] . "\n";
$msg = $msg . "Email: " . $_POST["FROM"] . "\n";
$msg = $msg . "Support: " . $_POST["Support"] . "\n";
$msg = $msg . "Model: " . $_POST["Model"] . "\n";
$msg = $msg . "Comments: " . $_POST["Comments"] . "\n";
$to ="[email protected]";
$subject = "Support";
$from = "From: " . $_POST["FROM"];
mail($to, $subject, $msg, $emailFrom, $from);
header("Location:support2.php");
?>
and the HTML part of the fom is like this:
<form id="form1" name="form1" method="post" action="support.php?action=email">
<table width="700" border="0" cellspacing="10" cellpadding="10">
<tr>
<td valign="middle" class="formtext">*First name:</td>
<td width="455" valign="middle"><label>
<input name="FirstName" type="text" class="form-textbox" id="FirstName" />
</label></td>
</tr>
<tr>
<td valign="middle" class="formtext">*Last name:</td>
<td valign="middle"><input name="LastName" type="text" class="form-textbox" id="LastName" /></td>
</tr>
<tr>
<td valign="middle" class="formtext">*Email:</td>
<td valign="middle"><input name="FROM" type="text" class="form-textbox" id="FROM" /></td>
</tr>
<tr>
<td valign="middle" class="formtext">*Telephone:</td>
<td valign="middle"><input name="Tel" type="text" class="form-textbox" id="Tel" /></td>
</tr>
<tr>
<td valign="middle" class="formtext"> </td>
<td valign="middle"> </td>
</tr>
<tr>
<td valign="middle" class="formtext">*Support required:</td>
<td valign="middle"><label>
<select name="Support" class="form-dropdown" id="Support">
<option selected="selected">Please select...</option>
<option value="Connection Issues">Connection Issues</option>
<option value="Technical Issues">Technical Issues</option>
<option value="Furniture Faults">Furniture Faults</option>
<option value="Other">Other</option>
</select>
</label></td>
</tr>
<tr>
<td valign="middle" class="formtext">Chair model:</td>
<td valign="middle"><input name="Model" type="text" class="form-textbox" id="Model" /></td>
</tr>
<tr>
<td valign="middle" class="formtext">*Please describe your issue:</td>
<td valign="middle"><textarea name="Comments" rows="5" class="form-textarea" id="Comments"></textarea></td>
</tr>
<tr>
<td valign="middle" class="maintext"> </td>
<td valign="middle" class="maintext"></td>
</tr>
<tr>
<td valign="middle"> </td>
<td valign="middle"><label>
<input name="Submit" type="submit" class="form-submit-button" value="Submit" />
</label></td>
</tr>
</table>
</form>MurraySummers you sir, are an absolute legend! This worked perfect straight off the bat!
I really apreciate your lightning fast reply!
Thanks again.
Bradley -
Howdy all,
I use DW 2004MX. If this topic has been addressed before, I'm
sorry. I am trying to make a very simple form mail work on my
website; name, address, phone # and send. I know for a fact there
are two types of form scripts on my server, and both are activated.
One is a CGI (gdform.cgi), and the other is a PHP (gdform.php). My
server is Godaddy if that matters. I have read many messages about
form mail, but cannot find out how to MAKE IT ALL WORK. I have been
looking for a step-by-step answer, but no luck so far. BTW, I am a
newbie. The manual I have is "aftermarket", and is near useless for
the form mail stuff. The web address is www.azaleatrail.com
Any help would be greatly appreciated,
Thanks,
MonaLisaWest> One is a CGI (gdform.cgi), and the other is a PHP
> (gdform.php). My server is Godaddy if that matters.
my suggestion from trying to sort out questions from others
hosted with go
daddy- don't bother with either of those scripts.
I assume that you can use php files within your site?
If yes- i suggest this script:
http://boaddrink.com
-->phpformmail
the instructions are in the zipped folder.
short list of instructions i suggest (use your own info of
course)
http://groups-beta.google.com/group/macromedia.dreamweaver/search?q=alan+php
formmail+edit+recipient&start=0&scoring=d&
1)go to
http://boaddrink.com
-->phpformmail
download it.
http://www.boaddrink.com/projects/files/phpformmail/phpformmail_class...
.2.zip
extract the ZIP file.
2) open formmail.php in dreamweaver
Make the following changes (in code view, turn line numbers
on)
2a)
line 4,
define('CHECK_REFERER', true);
change to:
define('CHECK_REFERER', false);
reason: too many people use a firewall or Norton security to
restrict this.
2b)
Line 43
$referers = array('www.example.com', 'example.com');
change to the url address of your web site.
reason: this probably isn't needed since we just turned the
referrer
checking off. but change it anyway.
2c) *********this is the hard-coding of the recipient address
into the php
file, where it is totally invisble**********
Line 46
$recipient_array = array();
change to:
$recipient_array = array('me' =>
'[email protected]);
**put YOUR email address in to replace
[email protected]
reason: this sets the email address the form results will be
sent to.
3) now do a File-->Save As and save this file to within
this Local Site
folder.
4) in dw's File Panel, find formmail.php and upload it to the
remote site.
5) Now open your form html file in dreamweaver,
5a)click the mouse into the form area, and select the
<form> tag on the
lower left margin of the design window.
In the Property Inspectory, it should now show the properties
of the <form>
tag. In the Property Inspector, to the right of the ACTION
line, click the
folder icon and browse to and select the copy of the
formmail.php file
you've saved to within this site.
5b) now go to dw menu-->Insert-->Form
Objects-->Hidden Field
This inserts a hidden form field.
In the property inspector, change the NAME of this field to:
recipient
And the VALUE of this field to: me
the code should look like:
<input name="recipient" type="hidden" id="recipient"
value="me">
6) Save and upload the form page.
Try the form from the website.
Optional:
make a new page for a thank you for submitting message.
In the form, insert another hidden field.
Name: redirect
Value: the full absolute
http:// address to the new thank you page.
There is other information about that script in the Docs
folder.
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/ -
Can you auto-attach files in a PHP form?
Hi there,
Have been looking over everywhere for a solution to my problem. I am going to try and be as clear as I can about the problem.
I have had some experience making simple PHP forms that let the user put their name, email, subject and body text and send it in an email using the form.
But for a project I am currently undertaking - the client has requested a form that will pre-attach a particular document to the email when it is sent. All the user has to do is input the email address of the adressee and their name/email address and all the other fields are custom made (i.e. subject, body text) - and the email will be sent to the selected recepient with the file already attached.
I was envisaging the PHP script would collect the reference for a file that is already sitting on the web server and attach it in the function.
Is there anyway to do this? Because if it isn't I may as well tell the client to go and use outlook - because the web form will really have no purpose.
Thanks in advanceHi have proceeded along the path of inserting links
into PHP generated email but I am having trouble in outputting the body message in HTML - All I get out
in the output email is the HTML tags with the text (plain text).
Did some research and found out that I have to determine the content type/charset.
I have tried to do this in my PHP but to no avail. Also I am not getting the email or name of the sender in the email that is generated....
Anyway, there is the PHP code (and it's not that tight but it works):
AND SOME DEFAULT TEXT THAT WILL CONTAIN LINKS TO NECESSARY FILES TO DOWNLOAD:
link to PDF '.$field_message; $headers = 'From: '.$cf_yremail."\r\n"; $headers .= 'Reply-To: '.$cf_yremail."\r\n"; /* If your e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $mail_to)) { ?>
Any help on this would be much appreciated....
Thanks -
I wanted to share with the community a work around we have developed for using the mail function within PHP when compiled with NSAPI (Iplanet SunOne).
Quick summary of the problem.
Description:
mail() stops working a few minutes after Sunone 6 web server starts,
which makes this look like a resource problem...
Config line: "./configure --with-mysql=/usr/local/mysql
--with-nsapi=/home/netscape/servers --enable-track-vars --enable-libgcc
--with-ldap"
Note that mail() does work briefly after web server is restarted so it
doesn't seem to be a configuration problem.
Reproduce code:
<?php
mail("[email protected]", "Test Subject", "Test Body");
?>
Expected result:
expect to receive an email
Actual result:
no email received
I get no php or system errors but the following error shows up in the
IPlanet logs:
"trying to GET /is/sys
net/test/email.php, php4_execute reports: PHP Warning: mail(): Could
not execute
mail delivery program '/usr/lib/sendmail -t'"
Solution:
Here's a solution that appears to work for us so far. It might be nice
if the php developers would consider a --with-sfio parameter in
configure that took care of this. Our exec command is still broken so
I'll probably have to do this same type of thing for that.
1. install sfio from AT*T
2. setenv LIBS "-L/usr/local/lib/sfio -lsfio"
3. modify ext/standard/mail.c
4. modify /usr/local/include/sfio/sfio.h so references to other sfio
header files are absolute paths (if I use -I/usr/local/include/sfio to
find the files it produces errors for files other than mail.c)
5. run configure and compile as normal
here's a diff or my code and the original mail.c:
diff mail.c mail.c.orig
23c23
< #include </usr/local/include/sfio/sfio.h>
#include <stdio.h>177c177
< Sfio_t *sendmail=NULL;
FILE *sendmail;215c215
< sendmail = sfpopen(sendmail, sendmail_cmd, "w");
sendmail = popen(sendmail_cmd, "w");224c224
< sfclose(sendmail);
pclose(sendmail);228,229c228,229
< sfprintf(sendmail, "To: %s\n", to);
< sfprintf(sendmail, "Subject: %s\n", subject);
fprintf(sendmail, "To: %s\n", to);
fprintf(sendmail, "Subject: %s\n", subject);231c231
< sfprintf(sendmail, "%s\n", headers);
fprintf(sendmail, "%s\n", headers);233,234c233,234
< sfprintf(sendmail, "\n%s\n", message);
< ret = sfclose(sendmail);
fprintf(sendmail, "\n%s\n", message);
ret = pclose(sendmail);This information has also been posted on the PHP forum at
http://bugs.php.net/bug.php?id=28748
We had a heck of a time finding much information about the exec and mail not working on Solaris so we wanted to share this with everyone. Hope it helps someone out!
Cheers,
Ken and David
Kalamazoo CollegeIf you want to send through your mail server you will only need SMTP for sending. You can however also send through your ISP's mail server.
As far as security goes: The most common issue is not PHP's mail function, but the web forms used to call it. If you go for one of the most common Forum SW, you should probably be OK.
Maybe you are looking for
-
I am using Mail with OS 10.9.1. I used to be able drag and drop names from my address book into the address header, but can no longer do that. I now have to type each name in. Does anyone know if there is a setting for this or is it a feature of t
-
I wanted to create a simple approval workflow. Hence I opted to start from scratch rather than copy the OOTB approval WF. Using SharePoint Designer (not Visual studio) I created a reusable workflow and have added the built in 'Start approval process'
-
HT4818 iMac Bootcamp Windows 7 Problem
After starting up the 2. Monitor doesnot work, I spend 8 Hours with this problem - no solution! Can anyone help me?
-
Problem while deploying entity beans
Hi, We are using JDeveloper 3.2.2 (NT) and 8.1.7 (NT) to deploy EJB's. Now we are trying to deploy the entity bean to Oracle JVM. We are facing the following problem while deploying an entity bean . "Persistence provider declared in the deployment de
-
Best connection w/ iMac?
I am soon making the transition from a PC to a new iMac. I have a 40 GB 4th gen click-wheel ipod. I's pretty sure that I can connect it to the new iMac using USB or a firewire - is either one superior? Is there one that I should go with. Also, should