Jump to content


Photo

Ok simple question looking for simple answer.....


  • Please log in to reply
7 replies to this topic

#1 timgetback

timgetback
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts

Posted 02 August 2006 - 06:43 PM

I want to send html variables that are using the post method via php mail to an account........
here is my mail.php file:

<?
$to = "mail@mailer.com";
$subject = "Email Info";
$info1 = $_POST['name']
$info2 = $_POST['age']
$body = "$info1 , $info2";
if (mail($to, $subject, $body)) {
  echo("<p>message successfully sent!</p>");
} else {
  echo("<p>Error Try again...</p>");
}
?>



Ok... i used action= mail.php however it doesnt show whether or not the message was sent or not... allso the account is not recieving the message if anyone can deliever a straight forward answer it would be great.

#2 bpops

bpops
  • Members
  • PipPipPip
  • Advanced Member
  • 232 posts

Posted 02 August 2006 - 06:45 PM

If you're not seeing anything, my first suggestion would be to change <? to <?php
The former is not supported by all installations (or servers) with php. I've seen people on these forums before with this problem.

also, with your form, you are doing method="post" and not method="get" right?

#3 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 02 August 2006 - 06:48 PM

Ok... i used action= mail.php


action = mail.php or action="mail.php"?
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#4 timgetback

timgetback
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts

Posted 02 August 2006 - 06:54 PM

its method= "post" and action= "mail.php"

#5 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 02 August 2006 - 07:05 PM

Well it doesn't sound like the script is being run for some reason, or at least it's not getting to the IF statement. Try putting an echo in on its own somewhere just to make sure.
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#6 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 02 August 2006 - 08:23 PM

you're missing a ; after $_POST['name'], and after $_POST['age'].

the reason you didn't see anything is probably that you have display error off.
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#7 timgetback

timgetback
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts

Posted 02 August 2006 - 08:42 PM

how do you turn that on??? im really new to this stuff. thanks it tells me that the message was succesfull but when i check my email theres nothing there.


#8 timgetback

timgetback
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts

Posted 03 August 2006 - 12:41 AM

Ok i got another problem.... when i send my mailto.php file with the following code:

<?php
$to = "email@domain.com";
$subject = "Email Info";
$info1 = $_POST['info1'];
$info2 = $_POST['info2'];
$body = "info1: $info1 ,info2: $info2";
if (mail($to, $subject, $body)) {
  echo("<p>message successfully sent!</p>");
 } else {
  echo("<p>Error Try again...</p>");
 }

?> 


It changes the mail function to an array function so it ends up like this when i load it:

<?php
$to = "email@domain.com";
$subject = "Email Info";
$info1 = $_POST['info1'];
$info2 = $_POST['info2'];
$body = "info1: $info1 ,info2: $info2";
if (array($to, $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
 } else {
  echo("<p>Error Try again...</p>");
 }

?> 


What should i do? cause when i leave the array function in, and add the mail function it also changes
Before:
if (array($to, $subject, $body)) {
  echo("<p>Login successfully sent!</p>")
  mail($to, $subject, $body);
 } else {
  echo("<p>Error Try again...</p>");
 }

?>
After:
if (array($to, $subject, $body)) {
  echo("<p>Login successfully sent!</p>")
  array($to, $subject, $body);
 } else {
  echo("<p>Error Try again...</p>");
 }

?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users