PHP noob - help

Associate
Joined
6 Jan 2006
Posts
803
Location
Ayy
Hey guys, can't seem to get my php send mail form to work, althoiugh i've had it working fine in the past which is odd.

For some reason though, it just wont send an email, although it appears to be working fine when you fill it out.

Here is my HTML code:

Code:
<p>Your Name<br/>
<input name="name" type="text" size="60" />
</p>
<form method="post" action="sendmail.php">
<p>&nbsp;</p>
<p>E-mail Address<br />
<input name="email" type="text" id="email" size="60" />
</p>
<p>&nbsp;</p>
<p>Subject:<br />
<input name="subject" type="text" id="subject" size="60" />
</p>
<p>&nbsp;</p>
<p>Message<br />
<textarea name="additional" rows="8" cols="57"></textarea>
</p>
<p>
<input name="submit" type="image" src="Images/submit.png" />
</p>

And here is my php code for sendmail.php:

Code:
<?php
  $name = $_REQUEST['name'] ;
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  $additional = $_REQUEST['additional'] ;

  if (!isset($_REQUEST['email'])) {
    header( "[email protected]" );
  }

  else {
  	mail( "[email protected]", "Some feedback!",
    	"$message\nSubject:\n $subject \nMessage:\n $additional", 
		"From: $name <$email>" );
  	header( "[email protected]" );
  }
?>

Thanks for any help, but i really am clueless about php.
 
Thanks for the replies.

Tillus:

I did have a closing </form> tag, I just forgot to copy it over, so my bad,
but I did fix the name tag so it was within the <form> tag, didn't change anything unfortunatley.

and i'll try to use those header tags suarve, so thanks for that.

Anyway after finding that nothing worked, I changed the request tags, to post tags instead, again didn't really change anything :(

This is my code to date, so any input would be great.

PHP:
<?php
  $name = $_POST['name'] ;
  $email = $_POST['email'] ;
  $subject = $_POST['subject'] ;
  $message = $_POST['message'] ;
  $additional = $_POST['additional'] ;

  if (!isset($_REQUEST['email'])) {
  header( 'Location: http://www.abc.com/feedback.html' );
  }
  elseif (empty($name) || empty($email) || empty($subject) || empty($additional)) {
  header( 'Location: http://www.abc.com/error.html' );
  }
  else {
  mail( "[email protected]", "Some feedback",
    	"$message
		 \nSubject:\n $subject 
		 \nMessage:\n $additional", 
		"From: $name <$email>" );
  header( 'Location: http://www.abc.com/thankyou.html' );
  }
?>

And this is the HTML:

Code:
<form method="post" action="sendmail.php">

<p>Your Name</p>

<input name="name" type="text" id="name" size"60" />

<p>E-mail Address</p>

<input name="email" type="text" id="email" size"60" />

<p>Subject</p>

<input name="subject" type="text" id="subject" size"60" />

<p>Message</p>

<textarea name="additional" type="text" id="additional" rows="8" cols="57"></textarea>

<input type="image" name="submit" src="images/submit.png" />

</form>
 
Back
Top Bottom