PHP Form- It just won't send!

This is a discussion on "PHP Form- It just won't send!" within the PHP Forum section. This forum, and the thread "PHP Form- It just won't send! are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jun 11th, 2007, 17:47
Up'n'Coming Member
Join Date: Apr 2007
Location: Norwich, Norfolk - England
Age: 16
Posts: 83
Thanks: 2
Thanked 5 Times in 4 Posts
Question PHP Form- It just won't send!

Hiya, I need some help. Ive designed a form in PHP but I just can't seem to get it to work. Here are the 2 pages, the first is contact.php (http://unsc.awardspace.co.uk/contact.php), nd when they send it, it goes to sendeail.php (http://unsc.awardspace.co.uk/sendeail.php).

Heres the code for Contact (Well the main form php)
PHP: Select all

<form method="post" action="sendeail.php">
          <p>
            <span class="style4">
  <?php
$ipi 
getenv("REMOTE_ADDR");
$httprefi getenv ("HTTP_REFERER");
$httpagenti getenv ("HTTP_USER_AGENT");
?>
            
  <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
  <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
  <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
            
            Officers Name: 
            <input type="text" name="visitor2" size="35" />
            <br />
            Users Name: 
              <input type="text" name="visitor" size="35" />
            <br />
            Your Email:
              <input type="text" name="visitormail" size="35" />
            <br />
            Promote/Demote:
            <select name="attn" size="1">
              <option value=" promote ">Promote </option>
              <option value=" demote ">Demote </option>
            </select>
            <br />
            Reason (Must Include Date):            </span><br />
            <textarea name="notes" rows="10%" cols="50%"></textarea>
<br />
            <input type="submit" value="Send Mail" />
            <br />
          </p>
          </form>
And heres the sendeail.php code
PHP: Select all

<?php

$ip 
$_POST['ip'];
$httpref $_POST['httpref'];
$httpagent $_POST['httpagent'];
$visitor $_POST['visitor'];
$visitormail $_POST['visitormail'];
$notes $_POST['notes'];
$attn $_POST['attn'];

if(!
$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo 
"<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput "<h2>Feedback was NOT submitted</h2>\n";
echo 
$badinput;
}

if (
eregi('http:'$notes)) {
die (
"Do NOT try that!! You N00B! ");
}

if(empty(
$visitor) || empty($visitormail) || empty($notes )) {
echo 
"<h2>Use Back - fill in all fields</h2>\n";
}

$todayis date("l, F j, Y, g:i a") ;

$attn $attn ;
$subject $attn;

$notes stripcslashes($notes);

$message " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
"
;

$from "From: $visitormail\r\n";


mail("jjpeacha104@hotmail.com"$subject$message$from);

?>

<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />

Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout str_replace("\r""<br/>"$notes);
echo 
$notesout?>
<br />
<?php echo $ip ?>
Can you see anything wrong with them?

Jjpeacha
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jun 11th, 2007, 17:52
Elite Veteran
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Form- It just won't send!

Do you get an error? Or it just won't send?

And in sendmail.php, $notes = stripcslashes($notes); should be stripslashes (you had a "c" in there)

Last edited by karinne; Jun 11th, 2007 at 17:54.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jun 11th, 2007, 21:50
Up'n'Coming Member
Join Date: Apr 2007
Location: Norwich, Norfolk - England
Age: 16
Posts: 83
Thanks: 2
Thanked 5 Times in 4 Posts
Question Re: PHP Form- It just won't send!

Everything works as it should appart from the fact it just wont send to my email address!

JJpeacha
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jun 11th, 2007, 21:56
Reputable Member
Join Date: Apr 2007
Location: Scotland
Age: 17
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Form- It just won't send!

Are you sure that mail is configured properly on your server?

And that the address is spelt right.... lol.

if not try....

PHP: Select all

$mail mail("jjpeacha104@hotmail.com"$subject$message$from);

if(
$mail) {
  echo 
'Mail sent successfully';
} else {
  echo 
'problem sending mail';

That'll tell you if it thinks it's send or not at least. try and work it out from there.

Last edited by Blake121; Jun 11th, 2007 at 21:59.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jun 13th, 2007, 13:27
New Member
Join Date: Jun 2007
Location: UK
Age: 25
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Form- It just won't send!

what server you on?? you may need to define the ini_set and mail adress to send mail from ie root@yourdomian.com

PHP: Select all

ini_set("sendmail_from""root@yoursite.com");
mail("email1, email2""Website Enquiry""$message""From: Website Enquiry");
header"Location: http://www.yoursite.com/thankyou.php); 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Jun 13th, 2007, 13:29
New Member
Join Date: Jun 2007
Location: UK
Age: 25
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Form- It just won't send!

also check you spam box as they ight b sending and stuck in there :P
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
email, form, php, send

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Form send in email Bravo81 PHP Forum 20 Jan 17th, 2008 11:47
PHP Form to send sender an email? gribble PHP Forum 5 Mar 26th, 2007 13:06
Form won't send to email? Inkers Web Page Design 3 Jan 22nd, 2007 16:11
how to send filled feedback form reeta.vadgama Web Page Design 5 Jul 24th, 2006 23:23
Send Email w/ Attachment from ASP form laundrymedia Classic ASP 3 Nov 7th, 2003 20:44


All times are GMT. The time now is 23:42.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42