Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-11-2006, 08:49 PM   PM User | #1
harbingerOTV
Senior Coder

 
Join Date: Jan 2005
Location: Memphis, TN
Posts: 1,765
Thanks: 8
Thanked 123 Times in 121 Posts
harbingerOTV will become famous soon enough
another form thred? yep, kick me please

Alright I'll be the first to say."I don't know jack about php". Sure I can use it and cut it up and manhandle the living crap out of it to make it work for me, but I'm at a crossroads where I have tried all the little things and it's not getting better.

I'm using (well abusing) a contact form I have previously manhandled and trying to get it to work for my needs. All is good and well so far and down to the last issue.

What i want to happen is that the recipient in the select box be written as the subject line. Sounds easy enough, and probally is. After 2 hours tyrying different ways of lookoing at it and seeing what's going on I still can't get it to do what i want it to do.

here's the line that writes the subject:
PHP Code:
$this->_subject ' tb.net : ' $who "\n"
So in this case any email sent to me from the form shoul dbe sent to me with the subject line of "tb.net : "select box selection" "

I made the $who command so It might be that you just can't name anything anything you want in php. Like I said I'm a novice.

the select box looks like this:
Code:
<label style="height:22px;padding-top:0;">Direct your email to</label><br><select 

name="support" id="support" style="width:160px;height:22px;border: 2px solid 

#818D96">
<option />-Select One-
<option />General Information
<option />Gaming Information
<option />eBay Information
<option />Webmaster
</select>
and the $to looks like this:
PHP Code:
$to="";
$info_emails = array("harbingerofthevoid");
$gaming_emails = array("harbingerofthevoid");
$ebay_emails = array("harbingerofthevoid");
$web_emails = array("harbingerofthevoid");
$addrs = array("General Information"=>$info_emails,"Gaming 

Information"
=>$gaming_emails,"eBay 

Information"
=>$ebay_emails,"Webmaster"=>$web_emails);
if (
$_POST["support"]) {
foreach(
$addrs as $key => $val) {
if (
$_POST["support"]==$key) {
for(
$i=0;$i<sizeof($val);$i++) {
$to.=$val[$i]."@yahoo.com,";

}
}
}
}
$to=substr($to,0,-1); 
now keep in mind that Im modifying this from an earlier hack job so things might not make sense.

Okay so heres the way I think it's working:

$to=
for each $addrs it equals $key
for each $key it is a $val
then it defines i as the 0 and says if 1 is less than the $val it becomes the $val + "email@addy,"

then it redifines $to as: $1 + array + @yahoo.com, -1

and it says it likes this:
PHP Code:
$to=substr($to,0,-1); 
so is it:

$to=substr($to, [minus nothing], -the comma) ?

if thats the case why can I not write:
PHP Code:
$who=substr($to,$val,-11); 
To essentially write:

$who=$to,$val[the recipient],-11[the @yahoo.com])

if the -1 in the first part is there to erase the comma ( it might not be but I'm learning)

than the -11 would erase 11 charachters right? or am i way off base?

In the end I'm trying to define the $who as the recipient of the email and have it added to the subject line of a sent email.
__________________
Stop making things so hard on yourself.
i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis
harbingerOTV is offline   Reply With Quote
Old 02-11-2006, 09:15 PM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
I think you are making this too hard on yourself. Give values to the options in the select menu.
Code:
<label style="height:22px;padding-top:0;">Direct your email to</label><br><select 

name="support" id="support" style="width:160px;height:22px;border: 2px solid 

#818D96">
<option selected="selected">-Select One-</option>
<option value="General Information">General Information</option>
<option value="Gaming Information" >Gaming Information</option>
<option value="eBay Information">eBay Information</option>
<option value="Webmaster">Webmaster</option>
</select>
Then assign the $subject variable to a post of the select menu
PHP Code:
$subject $_POST['support']; 
That should get the selected user value.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 02-12-2006, 01:21 AM   PM User | #3
harbingerOTV
Senior Coder

 
Join Date: Jan 2005
Location: Memphis, TN
Posts: 1,765
Thanks: 8
Thanked 123 Times in 121 Posts
harbingerOTV will become famous soon enough
_Aero_ i appreciatte that. i didn't use exactly how you worote it but I manhandled it once again to make it work. The form script I was butchering was requiring a subect. idisdnt want it to show the subject and instead use the select entery as the subject. using your code i figured out what I needed to do to make it work.

I appreciatte it as always.

-alan
__________________
Stop making things so hard on yourself.
i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis
harbingerOTV is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:00 AM.


Advertisement
Log in to turn off these ads.