PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old July 6th, 2002, 06:39 PM
russ russ is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: London, UK
Posts: 129 russ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to russ Send a message via Yahoo to russ
Mail()

I read a mail script tutorial, and pretty much copied the code, but it doesn't work for some reason

php Code:
Original - php Code
  1.  
  2. <?PHP
  3. if($submit){
  4. $msg = "Sender Name:t$_POST[name]n";
  5. $msg .= "Sender E-Mail:t$_POST[email]n";
  6. $msg .= "Message:t$_POST[msg]nn";
  7.  
  8. $recipient = "goodmusicforlamepeople@hotmail.com";
  9. $subject = "$_POST[subject]";
  10.  
  11. $mailheaders = "From: My Web Site <> n";
  12. $mailheaders .= "Reply-To: $_POST[email]nn";
  13.  
  14. mail($recipient, $subject, $msg, $mailheaders);
  15. echo "<b>Thank you!</b>n";
  16.  
  17. }
  18.  
  19. else{
  20. ?>
  21. <form method="post" action="<?=$PHP_SELF?>">
  22. Name: <input type="text" name="name" size="10"; maxlength="50" class="textbox">
  23.  
  24. <br>Email: <input type="text" name="email" size="10"; maxlength="50" class="textbox">
  25.  
  26. <br>
  27. <select name="subject" class="dropdown">
  28. <option value="news">News</option>
  29. <option value="album">Album Review</option>
  30. <option value="gig">Gig Review</option>
  31. <option value="interviews">Interview</option>
  32. <option value="tabs">Tab</option></select>
  33.  
  34. <br><textarea name="msg" cols=40 rows=8></textarea>
  35.  
  36.  
  37.  
  38.  
  39. <br><input type="submit" value="Submit" class="button"> <input type="reset" class="button">
  40. </form>
  41. <?php
  42. }
  43. ?>

Reply With Quote
  #2  
Old July 6th, 2002, 09:13 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Mail()

I think you need to have some type of email address in between the <>'s..:

$mailheaders = "From: My Web Site <> n";

also, what operating system? any error messages?

Reply With Quote
  #3  
Old July 6th, 2002, 09:39 PM
russ russ is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: London, UK
Posts: 129 russ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to russ Send a message via Yahoo to russ
RE: Mail()

I'm not getting any errors, But it doesn't seem to be sending, also, when I click submit it doesn't get rid of the form and display the "Thank you!". I'm using this script on l33t.ca server

Reply With Quote
  #4  
Old July 6th, 2002, 10:47 PM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: Mail()

I would suspect that the if($submit) condition is never being met.

Reply With Quote
  #5  
Old July 6th, 2002, 11:37 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: Mail()

seems odd to verify with the submit either way.. : try changing the following

php Code:
Original - php Code
  1.  
  2. <?PHP
  3. if($_POST[name] != "" && $_POST[email] != "" && $_POST[msg] != ""){
  4. $msg = "Sender Name:t$_POST[name]n";
  5. $msg .= "Sender E-Mail:t$_POST[email]n";
  6. $msg .= "Message:t$_POST[msg]nn";
  7.  
  8. $recipient = "goodmusicforlamepeople@hotmail.com";
  9. $subject = "$_POST[subject]";
  10.  
  11. $mailheaders = "From: My Web Site <> n";
  12. $mailheaders .= "Reply-To: $_POST[email]nn";
  13.  
  14. mail($recipient, $subject, $msg, $mailheaders);
  15. echo "<b>Thank you!</b>n";
  16.  
  17. }
  18.  
  19. else{
  20. echo "<b>all fields are required</b><br><br>n";
  21. ?>

Reply With Quote
  #6  
Old July 7th, 2002, 01:19 AM
russ russ is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: London, UK
Posts: 129 russ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to russ Send a message via Yahoo to russ
RE: Mail()

Thank you, its working perfectly now

Reply With Quote
  #7  
Old July 8th, 2002, 12:08 PM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: Mail()

I think your problem was that you didn't have "name=submit" in your submit button :

<input type="submit" name=submit value="Submit" class="button"> <input type="reset" class="button">
</form>

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Mail()


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway