Im unclear on if someone came to my site, and i wanted them to fill out a form and they pressed submit, how to get it sent to me?
<form action="<a href="mailto:whoever@.com"></a>" method="post">
can I put that as the action and it will get sent there? or is there a differnt way to do it?
processing form to be sent to email adress
Moderator: General Moderators
-
gavinbsocom
- Forum Commoner
- Posts: 71
- Joined: Tue Sep 30, 2003 9:51 pm
the action property takes an url as value not an anchor element.
TryAlways add the enctype property. Without netscape/mozilla-based browsers will not include the field values
Try
Code: Select all
<html>
<head>
<title>client-side email</title>
</head>
<body>
<A HREF="mailto:account@your.host?subject=A%20Subject&body=Some%20text">Send me an email</A>
<form action="mailto:account@your.host?subject=A%20Subject" method="POST" enctype="text/plain">
<input type="text" name="username" /><br />
<textarea name="comment"></textarea><br />
<input type="submit" />
</form>
</body>
</html>-
gavinbsocom
- Forum Commoner
- Posts: 71
- Joined: Tue Sep 30, 2003 9:51 pm
thats amazing, thankyou, but one quick question. why do you need the ? inbetween the email and the other thing. and 2 is subject a set thing can i chage thesubject to subject=info? also what does the enctype do? encript it?
<html>
<head>
<title>client-side email</title>
</head>
<body>
<A HREF="mailto:account@your.host?subject=info">Send me an email</A>
<form action="mailto:account@your.host?subject=info" method="POST" enctype="text/plain">
<input type="text" name="username" /><br />
<textarea name="comment"></textarea><br />
<input type="submit" />
</form>
</body>
</html>
<html>
<head>
<title>client-side email</title>
</head>
<body>
<A HREF="mailto:account@your.host?subject=info">Send me an email</A>
<form action="mailto:account@your.host?subject=info" method="POST" enctype="text/plain">
<input type="text" name="username" /><br />
<textarea name="comment"></textarea><br />
<input type="submit" />
</form>
</body>
</html>
the ? in a link separates the path from the parameters, i.e. subject is the parameter-name and info the value of this parameter .
take e.g. a look at the link that lead you here
viewtopic.php?t=13532
t=13532 is the parameter name/value pair that the script uses to find the thread you wanted.
and the common mailto:// implementation uses the parameter subject to fill in the subject-field
for enctype read http://www.w3.org/TR/html4/interact/for ... ef-enctype
take e.g. a look at the link that lead you here
viewtopic.php?t=13532
t=13532 is the parameter name/value pair that the script uses to find the thread you wanted.
and the common mailto:// implementation uses the parameter subject to fill in the subject-field
for enctype read http://www.w3.org/TR/html4/interact/for ... ef-enctype
-
gavinbsocom
- Forum Commoner
- Posts: 71
- Joined: Tue Sep 30, 2003 9:51 pm
hmm... on second thought i will.... here's an outline of a self processing form, just so you can use it to create one to play with...
Code: Select all
<?php
if(isset($_POST['process'])){
$err=FALSE; $errs=array();
/* make sure everything is ok (if not, set err to TRUE and place errors in errs array) */
if(!($err)){
/* set up the body */
/* set up the headers */
/* set up the subject */
mail($to, $sub, $body, $headers); // send the mail
}
}
if((!(isset($_POST['process'])))||($err)){ // if process isn't set, OR there's an error
/* give the frm, and any possible error messages */
}
?>