View Full Version : another form thred? yep, kick me please

02-11-2006, 09:49 PM
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:

$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:

<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

<option />-Select One-
<option />General Information
<option />Gaming Information
<option />eBay Information
<option />Webmaster

and the $to looks like this:

$info_emails = array("harbingerofthevoid");
$gaming_emails = array("harbingerofthevoid");
$ebay_emails = array("harbingerofthevoid");
$web_emails = array("harbingerofthevoid");
$addrs = array("General Information"=>$info_emails,"Gaming


if ($_POST["support"]) {
foreach($addrs as $key => $val) {
if ($_POST["support"]==$key) {
for($i=0;$i<sizeof($val);$i++) {


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:

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:

so is it:

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

if thats the case why can I not write:


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.

02-11-2006, 10:15 PM
I think you are making this too hard on yourself. Give values to the options in the select menu.

<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

<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>
Then assign the $subject variable to a post of the select menu

$subject = $_POST['support'];
That should get the selected user value.

02-12-2006, 02:21 AM
_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.