tcwaage Posted March 27, 2006 Share Posted March 27, 2006 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> Quote Link to comment https://forums.phpfreaks.com/topic/5909-email-form-with-checkboxes/ Share on other sites More sharing options...
shortj75 Posted March 27, 2006 Share Posted March 27, 2006 try this[code]$getemail=mysql_query("select * from your_table");while($getemail2=mysql_fetch_array($getemail)){echo "<input type=checkbox name=$getemail2[your_column]> $getemail2[your_column]";}[/code]that should display all the email addres in your database and set the value of the checkbox change your_table and your_column to the correct database names and you only need the one line of code and it will pull all of the email addresses Quote Link to comment https://forums.phpfreaks.com/topic/5909-email-form-with-checkboxes/#findComment-21102 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.