Hi, I have a website and webpage written in php and I need to make the page where a user can select from a drop down list which recipient they want their submission to go to (drop down list will have list of different congressmen which they can select which congressmen's email address they want their message to go to) including basic things I know how to do such as inputting their name, email, address, city, state, and message.

So I just need help with the php processing and front end on the drop down to do this.

    oh sorry, here is my process.php code

    <?php
    include("global.inc.php");
    $errors=0;
    $error="The following errors occured while processing your form input.<ul>";
    pt_register('POST','Name');
    pt_register('POST','Email');
    pt_register('POST','Phone');
    pt_register('POST','Address');
    pt_register('POST','City');
    pt_register('POST','State');
    pt_register('POST','ZipCode');
    pt_register('POST','Message');
    $Message=preg_replace("/(\015\012)|(\015)|(\012)/"," ", $Message);if($Name=="" || $Email=="" || $Phone=="" || $Address=="" || $City=="" || $State=="" || $ZipCode=="" || $Message=="" ){
    $errors=1;
    $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
    }
    if($errors==1) echo $error;
    else{
    $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
    $message="This is a message from NewGIBill.org
    
    ----------------
    SUBMITTERS INFORMATION
    ----------------
    
    Name: ".$Name."
    
    Email: ".$Email."
    
    Phone: ".$Phone."
    
    Address: ".$Address."
    
    City: ".$City."
    
    State: ".$State."
    
    Zip Code: ".$ZipCode."
    
    ----------------
    MESSAGE BELOW
    ----------------
    
    Message: 
    
    ".$Message."
    ";
    $message = stripslashes($message);
    mail("staff@mankatowebdesign.com","Message From The New GI Bill",$message,"From: NewGIBill");
    $make=fopen("admin/data.dat","a");
    $to_put="";
    $to_put .= $Name."|".$Email."|".$Phone."|".$Address."|".$City."|".$State."|".$ZipCode."|".$Message."
    ";
    fwrite($make,$to_put);
    
    header("Refresh: 0;url=http://www.newgibill.com/tell-a-friend.php");
    ?><?php 
    }
    ?>

      you are going to want to put a combo box on the page that is submitting to this one.

      <select name='emailto' id='emailto'>
          <option value='man1@website.com'>man1@website.com</option>
          <option value='man2@website.com'>man2@website.com</option>
          <option value='man3@website.com'>man3@website.com</option>
          <option value='man4@website.com'>man4@website.com</option>
      </select>
      
      $email_to = $_POST['emailto'];
      

        i wouldn't accept an email address via post for the recipient, it could be used by spammers

          im with you on that one. But that is the way he wanted to do it.

            dclamp wrote:

            im with you on that one. But that is the way he wanted to do it.

            not really

            <select name='emailto' id='emailto'>
            <option value='1'>man1</option>
            <option value='2'>man2</option>
            <option value='3'>man</option>
            <option value='4'>man4</option>
            </select>
            
            

            would be a lot better, stops email harvesters as well as abuse of form to send spam

              yeah that is the best way. I gave him the easiest way 🙂

                Write a Reply...