Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Mailto Error
Plenoptic
post Dec 4 2005, 02:14 AM
Post #1


Trap Double Mocha Member
***************

Group: [HOSTED]
Posts: 2,228
Joined: 5-November 05
From: That one place over there...
Member No.: 13,830



Well I have been very busy trying to get my site up and running and I was trying to make a form for people to fill out to apply to affiliate with my site but when they click submit it opens up a new email instead of sending the form. This is the code and link.

http://plenopticdesign.be/index.php?id=affiliates

CODE
<form method="get" action="mailto:plenopti@plenopticdesign.be">
What is your name?
<BR>
<INPUT NAME="name" VALUE="enter name here" TYPE="text">
<P>
What is your site name?
<BR>
<INPUT NAME="Site Name" VALUE="Young" Type="text" SELECTED>
<br>
<INPUT VALUE="Send" TYPE="submit">
<INPUT VALUE="Clear This Form" TYPE="reset">
</FORM>
Go to the top of the page
 
+Quote Post
tuddy
post Dec 4 2005, 02:28 AM
Post #2


Privileged Member
*********

Group: Members
Posts: 570
Joined: 5-July 05
From: Ballarat
Member No.: 9,042



Plenoptic, that is because you are using a HTML Form. HTML Forms don't have the power to send forms only, open an email and send it.

If you'd like it to send the form, you need to use a PHP Form. Or i think you can add so ASP to above code that will do it. But the above is not going to do it for you without opening email and sending it like a normal email.
Go to the top of the page
 
+Quote Post
Plenoptic
post Dec 4 2005, 02:31 AM
Post #3


Trap Double Mocha Member
***************

Group: [HOSTED]
Posts: 2,228
Joined: 5-November 05
From: That one place over there...
Member No.: 13,830



Ok thanks. I will have to try and find a tutorial. If anyone could help me find a tutorial I would greatly appreciate it.
Go to the top of the page
 
+Quote Post
moldboy
post Dec 4 2005, 02:45 AM
Post #4


Privileged Member
*********

Group: Members
Posts: 518
Joined: 29-April 05
From: Canada Eh?!?
Member No.: 6,408



Try this.

in your code you must change a few things
change this:
CODE
<form method="get" action="mailto:plenopti@plenopticdesign.be">

to this:
CODE
<form method="post" action="makemymail.php">

this will submit this informaiton along to the file maikemymail.php, you could call it anything you want, but this should do.

next change this:
CODE

<INPUT NAME="Site Name" VALUE="Young" Type="text" SELECTED>

to this:
CODE
<INPUT NAME="Site_Name" VALUE="Young" Type="text" SELECTED>

no big just have to get rid of the space in the name.

Now we must make the actual mailer, I stole most of this code from the php manual, at php.net. Wwe will call this file makemymail.php, and place it in the same directory as the origional form.
CODE

<?php
/* recipients */
$to  = "your_email@address.here"; /*if you want more then one reciever check the manual at php.net */

/* subject */
$subject = "An afiliat request from $name";

/* message */
$message = "$name has requested to become an afiliat of you site, his/her site is $Site_Name";

/* additional headers */
$headers .= "To: <your_email@address.here>\r\n";
$headers .= "From: $name\r\n";

/* and now mail it */
mail($to, $subject, $message, $headers)
?>


I havn't check the code fully, however it should work fine. If there are any problems with it please post back.
Go to the top of the page
 
+Quote Post
Plenoptic
post Dec 4 2005, 02:49 AM
Post #5


Trap Double Mocha Member
***************

Group: [HOSTED]
Posts: 2,228
Joined: 5-November 05
From: That one place over there...
Member No.: 13,830



Thanks as it turns out I found the php necessary to fix it. I appreciate all of your help and will make sure to remember that. Everything now works fine.
Go to the top of the page
 
+Quote Post
tuddy
post Dec 4 2005, 02:54 AM
Post #6


Privileged Member
*********

Group: Members
Posts: 570
Joined: 5-July 05
From: Ballarat
Member No.: 9,042



Place the following code where you want your form:

CODE
form method="get" action="process.php">
What is your name?
<BR>
<INPUT NAME="name" VALUE="enter name here" TYPE="text">
<P>
What is your site name?
<BR>
<INPUT NAME="site_name" VALUE="Young" Type="text" SELECTED>
<br>
<INPUT VALUE="Send" TYPE="submit">
<INPUT VALUE="Clear This Form" TYPE="reset">
</FORM>


Then in a new document called process.php place the following code:

CODE
<?php
// The error message if there are one or more fields not filled in
$error = "There are some fields not filled in, <a

href=\"*YOUR WEBSITE*">Click here to go back</a>";

// Let's check if all fields are filled in!
if($name == "" || $site_name == "" ){
// Lets echo that error!;)
echo $error;
}

/*
if after all everything is filled in correct, lets start doing the mailscript...
Edit the variable's below to make them fit your needs
*/
else{
$yourwebsite = "*CHANGE*"; // Your website
$recipientname = "*CHANGE*"; // Whats your name ?!
$subject="*CHANGE*";  // The subject of the mail thats being sended
$recipient="*CHANGE*"; // the recipient

/*
The headers for the e-mail, no need to change it unless you know what you're doing
*/
$header = "From: $nickname <$email>\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$header .= "X-Priority: 3\r\n";
$header .= "X-MSMail-Priority: Normal\r\n";
$header .= "X-Mailer: PHP / ".phpversion()."\r\n";

/*
You can change the text below to whatever you wish to have
for the way the mail is gonne be outputted, you can use HTML!
*/
$content= "
Dear " . $recipientname . "," . $name . " has sent you an e-mail from " . $yourwebsite . ".<br />
<b>Message:</b>
" . $message . "
<hr noshade=\"true\" size=\"1\" color=\"#000000\" />
You can contact " . $name . " back at " . $site_name . ".";

// Lets send the e-mail by using the mail() function, no need to change below...this
// can be edited above!

mail($recipient, $subject, $content, $header);

// Message the user will see if the e-mail is succesfully sended

echo "Thanks! Your comments has been sent succesfully, " . $name . ".";
}
?>


Place this file in the same place as the above file with the form in it.

TIP: Take a copy of the file above with the form in it, rename it process.php then replace the form code with the above 'process.php' code. This will give the process page the same look and feel of the form page. You can also add any other things as needed.

--

This post has been edited by Dooga: Dec 4 2005, 04:26 AM
Go to the top of the page
 
+Quote Post
tuddy
post Dec 4 2005, 02:59 AM
Post #7


Privileged Member
*********

Group: Members
Posts: 570
Joined: 5-July 05
From: Ballarat
Member No.: 9,042



Too late, ah well it is now there for anyone else to use and come back on!! ...

I remember there being an error with the above code some time back, does any know what it might be looking at the above code??
Go to the top of the page
 
+Quote Post
CrazyRob
post Dec 10 2005, 09:25 AM
Post #8


ITS ALIVE.....MUHHHAAAA
*********

Group: Members
Posts: 532
Joined: 17-October 05
From: Chippenham UK
Member No.: 13,031



QUOTE(Plenoptic @ Dec 4 2005, 02:14 AM)
Well I have been very busy trying to get my site up and running and I was trying to make a form for people to fill out to apply to affiliate with my site but when they click submit it opens up a new email instead of sending the form.  This is the code and link.

http://plenopticdesign.be/index.php?id=affiliates

CODE
<form method="get" action="mailto:plenopti@plenopticdesign.be">
What is your name?
<BR>
<INPUT NAME="name" VALUE="enter name here" TYPE="text">
<P>
What is your site name?
<BR>
<INPUT NAME="Site Name" VALUE="Young" Type="text" SELECTED>
<br>
<INPUT VALUE="Send" TYPE="submit">
<INPUT VALUE="Clear This Form" TYPE="reset">
</FORM>

*



dont use an html code it will not work
i always use ether asp,vb,or php scripting they always work the best
PS:asp script is the best type of script to write mailto forms in
Go to the top of the page
 
+Quote Post
Plenoptic