Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,791
    Thanks
    8
    Thanked 131 Times in 129 Posts

    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

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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!||||

  • #3
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,791
    Thanks
    8
    Thanked 131 Times in 129 Posts
    _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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •