Jump to content

tcwaage

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by tcwaage

  1. I'm trying to make a email form where the sender can select his/her recipients by checking them.

    Here is my form code that diplays the recipients and checkboxes:

    <input type="checkbox" name="email[]" value="recipient 1" /> Recipient 1
    <input type="checkbox" name="email[]" value="recipient 2" /> Recipient 2

    And this is the php code:

    $recipient[] = "mail1@somewhere.com";
    $recipient[] = "mail2@somewhere.com";

    $mailto="";
    foreach(array_intersect(array_keys($recipient),array_values($_POST['email']))
    as $val)
    {
    $mailto.=$recipient[$val].',';
    }
    $mailto=trim($mailto,',');

    I keep getting these error messages:

    Warning: array_values(): The argument should be an array

    Warning: array_intersect(): Argument #2 is not an array

    Warning: Invalid argument supplied for foreach()

    And in addition the script displays a "not a valid email" error message, but this is caused by the array error.

    Please help!
  2. I'm trying to make an email form where the addresses are stored in a database. I want to be able to display all the addresses at the top of a form and the user be able to check the people he/she wants to send a message to. I know how to display all the addresses, but how do I code it so that the scipt checks if a person is to receive the msg or not? I've attached the form code so you get sort of an idea of what it would look like.

    <form id="form1" name="form1" method="post" action="">
    <table width="500" border="0">
    <tr>
    <td><input type="checkbox" name="checkbox" value="checkbox" />
    Person 1 </td>
    <td>Email address </td>
    </tr>
    <tr>
    <td> <input type="checkbox" name="checkbox2" value="checkbox" />
    Person 2 </td>
    <td>Email address </td>
    </tr>
    <tr>
    <td><input type="checkbox" name="checkbox3" value="checkbox" />
    Person 3 </td>
    <td>Email address </td>
    </tr>
    <tr>
    <td>Subject</td>
    <td><input type="text" name="textfield" /></td>
    </tr>
    <tr>
    <td>From</td>
    <td><input type="text" name="textfield2" /></td>
    </tr>
    <tr>
    <td>Return Email address </td>
    <td><input type="text" name="textfield3" /></td>
    </tr>
    <tr>
    <td>Message</td>
    <td><textarea name="textarea" cols="30" rows="10"></textarea></td>
    </tr>
    <tr>
    <td><div align="right">
    <input type="reset" name="Submit2" value="Reset" />
    </div></td>
    <td><input type="submit" name="Submit" value="Submit" /></td>
    </tr>
    </table>
    </form>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.