Jump to content

Recommended Posts

Greetings, I have a MySQL database where I am storing some basic info, one thing is an email address.  This is for my forum for church and I want to give the option to search for members, (based on another personality traits form I made) and have it return the email address, but hidden, so I just put like a checkbox next to each name.  That way you check the results whom you want to email, click submit and that sends all needed stuff to a mail form, where the $to will be populated with the email addresses. 

My problem is I am VERY new to all this, and I dont know how to store the emails as they come back form SQL and then how to send them to the form.  I am inserting relevant snippets of what I have tried so far, but I keep getting PHP error that I can't read from [].

I would appreciate any help, I am out of ideas.  THank you for reading!

 

This is my page that displays the search results;

$email = 0;

echo'<form action="forumMail.php">';

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['ministry1'] . "</td>";
echo "<td>" . $row['ministry2'] . "</td>";
echo "<td>" . $row['personality1'] . "</td>";
echo "<td>" . $row['personality2'] . "</td>";

$emails[] = $row['email'];

if($emails[$email])
{
   $email++;

   echo'<td>
	email?
	<input type="checkbox" name="mail[]" value="<?php $row[email]?>">  
	</td>';
}	

echo '</tr>';

}
echo'
<br>

<table border="0">
<tr>
<td>
<input type="submit" value="Submit">
</td>
</tr>

</form>';

 

this is a part of the form that submit invokes,

  {
foreach($POST_emails[] as $input) 
{ 
	$to = $input . ',' .""; 
}

Can I do something like this?

 

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['ministry1'] . "</td>";
echo "<td>" . $row['ministry2'] . "</td>";
echo "<td>" . $row['personality1'] . "</td>";
echo "<td>" . $row['personality2'] . "</td>";

$addresses = $row['email'] . ',';

.

.

.

then just past $address to the mail form in POST and use it as the $to?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.