Quick PHP Code Help Question

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Quick PHP Code Help Question
frostymoss
CZ Newbie
frostymoss has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: Aug 01, 2006
0.00 posts per day
Posts: 11
Points: 25
   
I have a form the user fills out. their name is set to a variable. an email also goes out, how would i make it print the variable in the email?

for instance: dear bob,



Back to top Reply with quote
#2   re: Quick PHP Code Help Question
floppydrivez
CZ Addict
 Codezwiz Site Donator
floppydrivez has been a member for over 18 year's 18 Year Member
usa.gif mississippi.gif
Occupation: graphic design
Age: 43
Gender: Male
Website:
Status: Offline
Joined: Feb 26, 2006
0.08 posts per day
Posts: 518
Points: 4,848
AIM Address Yahoo Messenger MSN Messenger 
I would need to see the mailer part of the form.

I basically need more info on variable that name is assigned too.



Back to top Reply with quote
#3   re: Quick PHP Code Help Question
frostymoss
CZ Newbie
frostymoss has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: Aug 01, 2006
0.00 posts per day
Posts: 11
Points: 25
   
$email_body = "

Dear member,

-whoever";
require_once('form.php');
?>

i would need member to be a variable that i have assigned (i.e.: $name) and its value printed.

thanks a lot!



Back to top Reply with quote
#4   re: Quick PHP Code Help Question
floppydrivez
CZ Addict
 Codezwiz Site Donator
floppydrivez has been a member for over 18 year's 18 Year Member
usa.gif mississippi.gif
Occupation: graphic design
Age: 43
Gender: Male
Website:
Status: Offline
Joined: Feb 26, 2006
0.08 posts per day
Posts: 518
Points: 4,848
AIM Address Yahoo Messenger MSN Messenger 
There are a few different ways to do this, depending on the rest of the script.

If the variable $name is already assigned, I think Dear $name, would work but I haven't ever tried that.

If its a nuke installation and they are members you could always pull their name from the db.

global $userinfo; //these globals need to be included
$name = $userinfo['username'];
$content = "$name";


Then you would still call to the variable as represented in the first scenario. I am sure you have your reasons for not giving me much to work with icon_cool.gif That nuke snipplet works for me not tested on any other installs.


Back to top Reply with quote
#5   re: Quick PHP Code Help Question
frostymoss
CZ Newbie
frostymoss has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: Aug 01, 2006
0.00 posts per day
Posts: 11
Points: 25
   
heres a paraphrased version of whats up there, to protect the owner's privacy most of it is changed.

$field_name = array('0' => 'Student Name', ...
$field_html_name = array('0' => 'sname', ...
$email_field = "semail";
$email_name = "Student Name";
$email_subject = "Workshop ";
$email_form_to = "registration@";
$email_form_cc = ".@.com";
$email_form_subject = "Workshop ";
$email_body = "

Dear $email_name,

dfadasga.";
require_once('form.php');
?>

i've tried setting email_name to sname and studen name, but then it just prints Student Name or sname instead of what its set to.



Back to top Reply with quote
#6   re: Quick PHP Code Help Question
Taut
PayPal Donation
CZ Revered Member
 Codezwiz Site Donator
usa.gif california.gif
Occupation: Entrepreneur
Gender: Female
Fav. Sports Team: SF Giants
Status: Offline
Joined: May 27, 2003
0.70 posts per day
Posts: 5530
Points: 481,695
   
You can try:

Dear <?php echo $email_name  ?>,


with email_name as the variable for the name of the student


Back to top Reply with quote
#7   re: Quick PHP Code Help Question
frostymoss
CZ Newbie
frostymoss has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: Aug 01, 2006
0.00 posts per day
Posts: 11
Points: 25
   
didnt work icon_sad.gif thanks anyway

that code just came up in the mail message.



Back to top Reply with quote
#8   re: Quick PHP Code Help Question
floppydrivez
CZ Addict
 Codezwiz Site Donator
floppydrivez has been a member for over 18 year's 18 Year Member
usa.gif mississippi.gif
Occupation: graphic design
Age: 43
Gender: Male
Website:
Status: Offline
Joined: Feb 26, 2006
0.08 posts per day
Posts: 518
Points: 4,848
AIM Address Yahoo Messenger MSN Messenger 
PM me form.php let me look at it. I am thinking to include the variable it must be in there.

Really you could look and find $email_message add $email_name to it.



Back to top Reply with quote
#9   re: Quick PHP Code Help Question
frostymoss
CZ Newbie
frostymoss has been a member for over 18 year's 18 Year Member
Gender: Male
Status: Offline
Joined: Aug 01, 2006
0.00 posts per day
Posts: 11
Points: 25
   
theres the problem i was hoping it wouldnt come to,

form.php is encrypted or something, but i'll send it anyway



Back to top Reply with quote
#10   re: Quick PHP Code Help Question
floppydrivez
CZ Addict
 Codezwiz Site Donator
floppydrivez has been a member for over 18 year's 18 Year Member
usa.gif mississippi.gif
Occupation: graphic design
Age: 43
Gender: Male
Website:
Status: Offline
Joined: Feb 26, 2006
0.08 posts per day
Posts: 518
Points: 4,848
AIM Address Yahoo Messenger MSN Messenger 
I will keep this short and sweet, basically what your asking for is impossible due to the encoding of form.php.

This is why, for the name to appear the mailer or form.php has to know to include the variable $name. If you could decode that you would find that $email_body is in there.

There is a simple way to test this theory, change $email_body to $email_bodys and see if the form still works.

Let me know.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum