Easy php form mailer for a form with in layers?<

admin

Administrator
Staff member
Hello, I'm fresh into this php stuff and need some help to get started... I'm building a page based on dynamic layers, and want o have a form in one of these. Can some one recommend any easy to install/configure form mailers and also give me a little help on how to alter my form code?
Thanks!well for one a form is all html, not php

you can stick that form anywhere you want just make sure your action is calling the page that has the php script in it.

what code do you have as of now?

also if you search some threads down you can see this has been asked and you can get the code off of there.I need help with where to put the right file, finding the right file and getting the form right...SORRY!
Ok, my server is structured like this:
d:
|----host|
| |
| |----apache2|
| |
| |---htdocs|
| |
| |---MYSITE!|
|
|---php|

As you can see I'm doing this on my own computer...
Alright, so far so...

This is how my form looks:

<form name="teenage_contact" action="" method="post">
<table border="0" cellpadding="5" width="200" cellspacing="1" bgcolor="ffffff">
<tr bgcolor="#000000">
<td>
<font face="veranda,tahoma" color="#ffffff" size="1">What is your name?</font><br>
<input type="text" name="mycoolname" size="40"><br>
<font face="veranda,tahoma" color="#ffffff" size="1">Where are you from?</font><br>
<input type="text" name="where" size="40"><br>
<font face="veranda,tahoma" color="#ffffff" size="1">E-mail address?</font><br>
<input type="text" name="replyemail" size="40"><br>
<font face="veranda,tahoma" color="#ffffff" size="1">So, what's up?</font><br>
<textarea name="massage" cols=40 rows=4 wrap="virtual">Aloha Teenage Idols, </textarea><br>
<input type="submit" name="submit" value="Send">
<input type="reset" name="reset" value="Clear">
</td>
</tr>
</table>
</form>

Alright, I'm am really having a hard time getting this, so treat me like a 5 year-old please!

Thanks!if you installed apache you are way above a 5 year old :P

ok so far so good, that form is correct. now you just need the action for the form. it all depends on what you want to do with it depends on the action. did you just want to email the form contents to you? then read this page

<!-- m --><a class="postlink" href="http://www.htmlforums.com/showthread.php?s=&threadid=29570">http://www.htmlforums.com/showthread.ph ... adid=29570</a><!-- m -->

if that is not what you want then just state here what you want to do when they push submit.Ok, I think I'm getting it!
I've changed the form slightly:

<script language="JavaScript" type="text/javascript">

function verify() {
var themessage = "You are required to complete the following fields: ";
if (document.teenage_contact.mycoolname.value=="") {
themessage = themessage + " - Your Name";
}
if (document.teenage_contact.where.value=="") {
themessage = themessage + " - Where You Are From";
}
if (document.teenage_contact.replyemail.value=="") {
themessage = themessage + " - Your E-mail Adress";
}
if (document.teenage_contact.massage.value=="") {
themessage = themessage + " - Your Message to Us";
}
//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
document.teenage_contact.submit();
}
else {
alert(themessage);
return false;
}
}

</script>

<form name="teenage_contact" action="send.php" method="post">
<input type="hidden" name="email_fields" value="[email protected]">
<input type="hidden" name="html_template" value="form.tpl.html">
<table border="0" cellpadding="5" width="200" cellspacing="1" bgcolor="ffffff">
<tr bgcolor="#000000">
<td>
<font face="veranda,tahoma" color="#ffffff" size="1">What is your name?</font><br>
<input type="text" name="mycoolname" size="40"><br>
<font face="veranda,tahoma" color="#ffffff" size="1">Where are you from?</font><br>
<input type="text" name="where" size="40"><br>
<font face="veranda,tahoma" color="#ffffff" size="1">E-mail address?</font><br>
<input type="text" name="replyemail" size="40"><br>
<font face="veranda,tahoma" color="#ffffff" size="1">So, what's up?</font><br>
<textarea name="massage" cols=40 rows=4 wrap="virtual">Aloha Teenage Idols, </textarea><br>
<input type="button" onclick="verify();" value="Send">
<input type="reset" name="reset" value="Clear">
</td>
</tr>
</table>
</form>

And the my send.php looks like:

<?php

$mycoolname = $_POST['mycoolname'];
$replyemail = $_POST['replyemail'];
$where = $_POST['where'];
$massage = $_POST['massage'];

$recipient = "[email protected]";
$subject = "Report from Hunchbackmailer";
$headers = "From: $mycoolname <$replyemail>\nReply-to: $replyemail\nContent-Type: text/plain\n";

$date = date("Y-m-d, H:i:s");

$message = "Sent by: $mycoolname\r\n
E-mail: $replyemail\r\n
From: $where\r\n
Message:\r\n
$massage\r\n
\r\n
Date of submission: $date\r\n
Remote IP: {$_SERVER['REMOTE_ADDR']}\r\n";

mail($recipient,$subject,$message,$headers);

header("Location: thankyou.html");

?>

When I click submit I get the code of send.php in my browser. Is this because I'm using my own computer as a server?
Is there anyway to be sure your doing it right even if you're on your own computer?

As you see I'd like it to send the mail and send the browser to thankyou.html!

Thanks for your patience! :cool:Do you have any good tutorials for a guestbook, or a good script?:D :rocker:no you can't run php on your computer without having a server installed.

you have to Download php and install it and then configure apache to run php.

but it looks ok.
 
Back
Top