WebmasterLingo
JustEdge Dedicated Servers

Go Back   WebmasterLingo > Programming Corner
User Name
Password

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old July 7th, 2005, 12:52 PM   #1
jaynsatx
Registered User
 
Join Date: Jul 2005
Posts: 3
jaynsatx is on a distinguished road
Post code check please

Ok..well here's the deal. I've been tryin to get ah form to work that acually sends me the details in the form to my email..I've tried about 4 different ways but for some reason the code always looks different in each script..so that has me kind od confused. But any how I read ah tutorial on how to make ah form and have the info emailed to you..that's great and just my luck everything works accept I don't receive the email..so I was wondering if I could get some of you to check out the code for me and see if there is something that might be coded wrong or something..here's the site I have with the workin script..

Www.skshyt.jt7.net/feedback.html

Here's the .php code which is names feedback.php and I have this file on my web host server.

<?php

$msg = "Name:t$namen";
$msg .= "Email:t$emailn";
$msg .= "Comments:t$commentsn";

$recipeint = "jaynsatx@tmail.com";
$subject = "Sidekickers chat feedback";

$mailheaders = "From:$emailn";
$mailheaders .= "Reply-To:$emailnn";

mail($recipient, $subject, $msg, $mailheaders);
header("Location:http://www.skshyt.jt7.net/thanks.html");
?>

Ok now here is the html code feedback.html

<html>
<head>
<title>feedback form</title>
</head>
<body>
<h1>Chat room comments<h1>

<form method="post" action="feedback.php">
Name: <input name="name" type="text" /><br />
Email: <input name="email" type="text" /><br />
Comments:<br />
<textarea name="comments" rows="5" cols="15">
</textarea><br/>
<input type="submit"/>
</form>

</body>
</html>

Well that's all..if you see something wrong or maybe you could direct me to ah easier code that cause the same affect as this code here I'd appreciate it..ah code that works though!..lol
jaynsatx is offline   Reply With Quote
Old July 8th, 2005, 09:08 AM   #2
ellipsis
Registered User
 
Join Date: Jul 2005
Posts: 7
ellipsis is on a distinguished road
Surprisingly, I have a very similar script on my site...that is, as far as the function is concerned. What you seem to be doing wrong is, you aren't extracting the form values correctly. Here's my script


Form: http://www.the-paragon.net/files/contact.php


Script:


if( isset($_POST['messauthor']) && isset($_POST['messemail']) && isset($_POST['messsubject']) && isset($_POST['messbody']) )
{
$to = "firestorm213@hotmail.com";
$from = $_POST['messauthor'];
$message = $_POST['messbody'] . "This was sent by " . $_POST['messemail'];
$subj = $_POST['messsubject'];
mail( $to, $subj, $message, "$from" );
}


Because when you have a form that is submitted, the values of that form are stored in the $_POST global array....and you have to access them using this method.


If your form elements name was "username" then the value will be stored in $_POST['username']


It's pretty simple....
__________________
There are 10 kinds of people in this world - those who understand binary and those who don't.
ellipsis is offline   Reply With Quote
Old July 12th, 2005, 01:37 AM   #3
Marshall
Registered User
 
Join Date: May 2004
Posts: 70
Marshall is off the scale
Send a message via AIM to Marshall
Well, that wont work unless register_globals is on which is a security risk so you need to change it a bit, at top put
Code:
$name = $_POST['name']; $email = $_POST['email'];

and also at the top you have
Code:
$recipeint = "jaynsatx@tmail.com";

and later on you put
Code:
mail($recipient, $subject, $msg, $mailheaders);

You need to double check your spelling of recipient in those because you switched the second i and e in it the first time making it send to an unset variable, changing it to match should fix it along with the first changes I said if register_globals are off.

You may also want to add an if statement like the person above me has and also a timer on form submissions so that one person cannot spam you with a billion emails by repeatedly hitting submit or refreshing the page.
Marshall is offline   Reply With Quote
Old July 18th, 2005, 03:40 AM   #4
nedeljko75
Registered User
 
Join Date: Jul 2005
Posts: 4
nedeljko75 is on a distinguished road
Also names of form(POST) vaiables in form and mail script are not same, so your script may work if you just change names of your form filelds:

$msg = "Name:t$namen";
$msg .= "Email:t$emailn";
$msg .= "Comments:t$commentsn";

you need to change this to something loke:
$msg = "Name:\t $name \n";
$msg .= "Email:\t $email \n";
$msg .= "Comments:\t $comments \n";


nedeljko75 is offline   Reply With Quote
Old August 31st, 2005, 04:43 AM   #5
kitty
Registered User
 
Join Date: Aug 2005
Posts: 16
kitty is on a distinguished road
mail($_POST["to"],$_POST["sub"],$_POST["msg"],"From:"&$_POST["from"]);
every one of these the name of the field of the form
__________________
NewEra
web develop
kitty is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 04:20 PM.

JustEdge Dedicated Servers