Jump to content


Photo

sending form data through email


  • Please log in to reply
14 replies to this topic

#1 supa

supa
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 30 July 2006 - 01:47 AM

:-\

Hi all

Ive read through the various FAQs on this subject here and elsewhere and managed to fix a few header errors etc but ive hit a dead end. 

I got my code here:

http://www.christian...ail-form-2.html

its a simple code for sending form data. the page containing the form is " who.php " and the processing file is " process.php " which can be found here:

www.supasleuth.com/beats/who.php and

www.supasleuth.com/beats/process.php

the problem is that although the return works fine i dont receieve the email with the data.

im hopeful that the error would be obvious to more php-experienced eyes than mine.  if anyone can take a moment to have a look i'll be grateful. (Im  using dreamweaver six and notepad ).

Cheers

MS



#2 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 30 July 2006 - 01:54 AM

Post the code you're using in process.php (we can't see it through a browser).

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!


#3 supa

supa
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 30 July 2006 - 02:51 AM

Post the code you're using in process.php (we can't see it through a browser).


Sorry!! 

Here's the code


process.php :
"

<?php
@extract($_POST);
$email = stripslashes($email);
mail('runamokg@yahoo.com',$subject,$text,"From: <$email>");
header("location:who.php");
?>

"


Taken from who.php (file containing the form) :

"
Sign up for updates

<form action="process.php" method="post">


E-mail:
<center><input type="text" name="email">
<input type="submit" value="Send">

</form>
"


Can anone spot a fault?

Cheers

#4 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 30 July 2006 - 03:19 AM

There were several things wrong with that script. Here is one that I wrote for you. It uses rather simple mail headers but it should do the trick. Give it a try.

The new process.php


<?php
$email = $_POST['email']
$email = stripslashes($email);

//checks to make sure that an email address was entered
if (!$email) {
    echo "You did not enter an email address";
    include("who.php");
    exit;
}
/*Now this section is realy all a matter of personal perference
I would personaly rather want to know what the email address meant.
You can change the subject to anything that you want*/

$to = "you@youremail.com";
$subject = "You have received a request for updates";
$message = "Hellow webmaster,
A person at YourSite.com as requested updates. There email address is as follows.
$email";
/*This section here contains the mail information.  You were  trying to use the From 
as the users email address.*/
mail($to, $subject, $message, "From: Update Request<you@yoursite.com>\nX-Mailer: PHP/" . phpversion()) or die("Unable to send mail");
echo "Your request has been sent and we will reply shortly";
include("who.php");
?>

Hope this helps,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#5 supa

supa
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 30 July 2006 - 04:18 PM

Hi Tom

many thanks on this one.. your help is greatly appreciated..

im on it right now il let peeps know how i get on!!

Cheers

M








#6 supa

supa
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 30 July 2006 - 05:01 PM

Im getting this error message:

Parse error: parse error, unexpected T_VARIABLE in /home/groots/public_html/supasleuth/beats/process.php on line 3


THis is how process.php is now


<?php
$email = $_POST['email']
$email = stripslashes($email);
if (!$email) {
    echo "You did not enter an email address";
    include("who.php");
    exit;
}
$to = "you@youremail.com";
$subject = "You have received a request for updates";
$message = "Hellow webmaster,
A person at YourSite.com as requested updates. There email address is as follows.
$email";
mail($to, $subject, $message, "From: Update Request<you@yoursite.com>\nX-Mailer: PHP/" . phpversion()) or die("Unable to send mail");
echo "Your request has been sent and we will reply shortly";
include("who.php");
?>

Any ideas what might be up with this??

Again cheers for the help!

MS

#7 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 July 2006 - 05:05 PM

try this ok.
<?php
$email = ($_POST['email']);
$email = stripslashes($email);
if (!$email) {
    echo "You did not enter an email address";
    include("who.php");
    exit;
}else{
$to = "you@youremail.com";
$subject = "You have received a request for updates";
$message = "Hellow webmaster,
A person at YourSite.com as requested updates. There email address is as follows.
$email";
mail($to, $subject, $message, "From: Update Request<you@yoursite.com>\nX-Mailer: PHP/" . phpversion()) or die("Unable to send mail");
echo "Your request has been sent and we will reply shortly";
include("who.php");
}
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#8 supa

supa
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 30 July 2006 - 05:39 PM

Cheers redarrow.

that code appears to work fine. the error and thank you messages work as and when needed.  the only problem is im not getting the emails through  :-[


the only changes i made were to insert my email addy to line 9 :

$to = "skivatron@aol.com";

and line 14:

mail($to, $subject, $message, "From: Update Request<skivatron@aol.com>\nX-Mailer: PHP/" . phpversion()) or die("Unable to send mail");

I feel like im getting closer..cheers for all the help!!! 

Can anyone see what might be wrong?

MS


#9 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 30 July 2006 - 07:04 PM

There you go mate fully done just add your email address ok.

this should work and if so you need to keep hold off what works for you i strongly advise you to backup a copy if it works.

good luck ok.

<?php

$email = ($_POST['email']);
$email = stripslashes($email);
if (!$email) {
echo "You did not enter an email address";
include("who.php");
exit;
}else{
$to      = 'nobody@example.com';
$subject = 'You have received a request for updates';
$message = 'Hellow webmaster,
A person at YourSite.com as requested updates. There email address is as follows.
$email';
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
echo 'Your request has been sent and we will reply shortly';
include("who.php");
}
?> 

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#10 supa

supa
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 30 July 2006 - 08:43 PM

Daym still not working.

Worse the validity check doesn't work now.   No - the validity check does work (modification to post).

Thanks for your patience mate.  I dont have a clue what's up.   

???



#11 supa

supa
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 30 July 2006 - 10:40 PM

can ne1 help??

Cheers

#12 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 30 July 2006 - 11:01 PM

What error are you getting?

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!


#13 supa

supa
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 31 July 2006 - 12:07 AM

Thers no error im just not getting the mail through.

#14 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 31 July 2006 - 03:58 PM

PHP has no way of reporting that the mail was sent, it just tells the mailserver to send a message. I'd say just double check your variables and such.

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!


#15 Ifa

Ifa
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts
  • LocationRauma, Finland

Posted 31 July 2006 - 04:05 PM

There also a possibility that a spam filter etc is blocking it...
I'm just a guy who likes to code for fun...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users