IBM developerWorks
           PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Click Here
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:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old May 30th, 2002, 11:45 AM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
mail() script problem

Hey folks, i'm having trouble with my feedback form thing, this is my script
php Code:
Original - php Code
  1.  
  2. <?php
  3.  
  4. $var1 = {$_POST['topic']};
  5. $var2 = {$_POST['message']};
  6. $var3 = {$_POST['name']};
  7.  
  8. $to = '"Admin" <me@mydomain.net>';
  9. $from = 'From: "$var3" <me@mydomain.com>';
  10. $subject = '$var1';
  11. $message = '$var2';
  12.  
  13. mail($to,$subject,$message,$from);
  14. echo 'Feedback Sent <a href="index.php">Return to Site</a>';
  15.  
  16. ?>


this works if there are no variables used, but as soon as i throw in some variables from the previous page it gives me a parse error, any suggestions?

Reply With Quote
  #2  
Old May 30th, 2002, 04:13 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: mail() script problem

PHP does not do variable substitution within single quotes, so this:

$from = 'From: "$var3" <me@mydomain.com>';
$subject = '$var1';
$message = '$var2';

neeeds to be :

$from = "From: "$var3" <me@mydomain.com>";
$subject = "$var1";
$message = "$var2";


Reply With Quote
  #3  
Old May 30th, 2002, 04:53 PM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: mail() script problem

thanks mate, cant believe i didnt notice that..lol

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > mail() script problem


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 3 hosted by Hostway