PDA

View Full Version : Matts script


becky gelke
11-15-2005, 12:54 AM
Hi again, I have almost got my blonde head around formmail scripts.....almost. :rolleyes:

I have added Matts script to this post, would any of you be kind enough to configure it, (hopefully making the changes in coloured text so it stands out)

I have just bought a reseller account, but I dont seem to be able to configure it to work for the domain I have also, which is part of the reseller account (Support wont help in scripting matters :angry: )

So say for example my reseller account is held in the name of resellerbec.co.uk and the name of the site I am building is in the name of newsite.co.uk how would I configure Matts script to send the results of any form on the newsite.co.uk site, to email address info@newsite.co.uk rather than webmaster@resellerbec.co.uk which is whats happening at the mo. Does any of that make sense?? It only just makes sense to me :rolleyes: The names are just made up names, as I havent uploaded anything yet to either site.

Thanks if you can help me, dont worry if you cant.

Bec

Creative Insanity
11-15-2005, 02:39 AM
I have never used Matt's scripts as never needed them before but looking at what you have said, would if not be a matter of just replacing webmaster@resellerbec.co.uk with info@newsite.co.uk

becky gelke
11-15-2005, 08:24 AM
I have never used Matt's scripts as never needed them before but looking at what you have said, would if not be a matter of just replacing webmaster@resellerbec.co.uk with info@newsite.co.uk
Thats my problem, Matts script is so vast I dont know which bit of it to change. Another question springs to mind here too, what do you usually use to process a form? I would be interested to find out, especially if it is relatively straight forwards.
Hopefully script is attached to this post.

davidj
11-15-2005, 09:00 AM
as i am a php developer i use PHP to process forms
and as i dont build websites just application then every thing i write is usually form based..

cant go wrong with php.

becky gelke
11-15-2005, 02:55 PM
That sounds interesting, do you have any sample php scripts for forms (that are easy to configure) that Matt one is just so long, I dont know where to start. Do most webhosts support php scripts?

I have just downloaded this php script (as below) is it correct, and is this all I need? Sorry for all the questions, things are difficult when you just cant quite get your head around them!!!

<span style='color:blue'><?php

/*
This is a simple PHP contact form script that will work with your Flash template.
If your webserver supports PHP, do the following to use it:

1. Change the "you@companyname.com" below to your email address.
2. Change the "CompanyName.com" to your website's name.
2. Upload this file to your web site.
3. Edit this template's content.txt file and set the value of txt_page5_contact_script_url
to the full URL to this script. For example, if this script is located at
http://www.yoursite.com/sendmail.php ('http://www.yoursite.com/sendmail.php'), the TXT file line should look like this:

&txt_page5_contact_script_url=http://www.yoursite.com/sendmail.php
*/


$email_address = "you@companyname.com";
$website_name = "CompanyName.com";

$name = $_POST["field1"];
$email = $_POST["field2"];
$subject = $_POST["field3"];
$message = $_POST["field4"];

$body = "\nThe following inquiry was submitted by $name:\n\n";

$body .= "Name:". $name. "\n";
$body .= "Email:". $email. "\n";
$body .= "Subject:". $subject. "\n";
$body .= "Message:\n\n". $message. "\n";

mail($email_address, "[".$website_name." Online inquiry] ".$subject, "$body","From: $name <$email>");
?></span>

davidj
11-15-2005, 03:10 PM
you need php support. most hosts if not every host should offer php. Its cheaper than asp usually. Its really easy to get to grips with and we are always here to help.

once you understand the basics then moving to more advanced stuff becomes really easy

the script you posted looks fine and will email to the variables you set... its that easy...

make sure your form action is set to the page where this script lives or you can paste the script above the html stuff on the page where your form is and set the form action to the same page

paste the code into <php ?> tags

in the script where it has



$name = $_POST["field1"];
$email = $_POST["field2"];
$subject = $_POST["field3"];
$message = $_POST["field4"];



just replace $_POST["field1"]; with $_POST["your field name"]; and make sure your form uses POST method

change


$body = "\nThe following inquiry was submitted by $name:\n\n";



to the message you want to have in the body (if any)

your sorted

Carter
11-17-2005, 06:43 PM
Becky Gelke,

I know you've spent a lot of time on Matt's Formmailer Script but had so many problems getting it to work on my site that I switched to form2mail.php. You should try it. Once you download this script, you just have to change two parts in the script (your email address and the path to your 'thank you" page). After downloading the script, you first link your form to that file and upload it to the root directory of your site. Its just that simple, takes less than five minutes.

You link the two forms in dreamweaver by clicking the mouse in the form area (inside the Red Rectangle that should be surrounding the entire form) Then, in the Quick Tag Selector that's in the bottom left margin of the design window, click on the <form> tag Finally, in the Property Inspector, set the Action by browsing to the file you want to submit the form data to.


Carter

becky gelke
11-19-2005, 02:43 PM
So, is this the form2mail script (as below)

<span style='color:blue'><?php
/************************************************** ****************************\
* Simple Page Protect Version 1.0 *
* Copyright 2000 Frederic TYNDIUK (FTLS) All Rights Reserved. *
* E-Mail: tyndiuk@ftls.org Script License: GPL *
* Created 02/28/2000 Last Modified 02/28/2000 *
* Scripts Archive at: http://www.ftls.org/php/ ('http://www.ftls.org/php/') *
************************************************** *****************************/
/************************************************** *****************************/
// Necessary Variables:

$TO = "you@fyou.org";
// En: E-Mail of mail recipient.
// Fr: E-Mail pour l'envoie.

$DEFAULT_EXIT_PAGE = "http://www.ftls.org/";
// En: exit page.
// Fr: page de sortie.

// End Necessary Variables section
/************************************************** ****************************/

$headers = "From: Anonymous on $SERVER_NAME <$mail>\n";
$headers .= "X-Mailler: PHP 3 Form2Mail made by FTLS, http://www.ftls.org/\n"; ('http://www.ftls.org/\n";')

$message = "";

while (list($key, $val) = each($HTTP_POST_VARS)) {
$message .= "$key : $val\n";
}

$message .= "\nSent by ".gethostbyaddr($REMOTE_ADDR). " ($REMOTE_ADDR)\n";

mail($TO, $subject, $message, $headers);
// En : Send mail
// Fr : Envoi du mail

if(! $exit_page)
$exit_page = $DEFAULT_EXIT_PAGE;

Header("Location: ".$exit_page);
// Exit -> $exit_page

?> </span>

I have also just downloaded this one, it came with a template I purchased, is it better, or am I better off with the first one??????
<span style='color:red'><?php

/*
This is a simple PHP contact form script that will work with your Flash template.
If your webserver supports PHP, do the following to use it:

1. Change the "you@companyname.com" below to your email address.
2. Change the "CompanyName.com" to your website's name.
2. Upload this file to your web site.
3. Edit this template's content.txt file and set the value of txt_page5_contact_script_url
to the full URL to this script. For example, if this script is located at
http://www.yoursite.com/sendmail.php ('http://www.yoursite.com/sendmail.php'), the TXT file line should look like this:

&txt_page5_contact_script_url=http://www.yoursite.com/sendmail.php
*/


$email_address = "you@companyname.com";
$website_name = "CompanyName.com";

$name = $_POST["field1"];
$email = $_POST["field2"];
$subject = $_POST["field3"];
$message = $_POST["field4"];

$body = "\nThe following inquiry was submitted by $name:\n\n";

$body .= "Name:". $name. "\n";
$body .= "Email:". $email. "\n";
$body .= "Subject:". $subject. "\n";
$body .= "Message:\n\n". $message. "\n";

mail($email_address, "[".$website_name." Online inquiry] ".$subject, "$body","From: $name <$email>");
?></span>

Carter
11-21-2005, 04:44 AM
Becky Gelke,

Actually, I have not seen or used either of the scripts that you provided below. You can find the form2mail.php script from numerous sites on the internet - for free. For example, I just downloaded this script for sure at:

http://web4future.com/easiest-form2mail.htm ('http://web4future.com/easiest-form2mail.htm')

See the upper right portion of the page for the download link, in red. By the way, I have not visited this site before, have no idea what its about, have no involvement with the providers or etc... I simply searched google for form2mail.php and found it there. Nevertheless, its the version that I use on my site (www.pbc5star.org). I learned about the script from the webmaster at www.soleproductions.com (codename Youthman)

Now, once you download the file and change those two lines that I mentioned below you simply copy the form2mail.php file to your .htdocs folder of your site and you're done.

(I know someone that copied the content of the script and pasted into their form -Do not do this cause it won't work).

Carter