steviemac Posted March 10, 2007 Share Posted March 10, 2007 Hi, I have e-mail addresses in a table and I want to be able to send one email to all users. Right now I am echoing a form for each email address in the table. I just want one form. This is what I have tried <?php $query = "SELECT email_address as email FROM IDC"; $result = mysql_query($query) or die(mysql_error()); { ///This TD of links and TD of Location while($record = mysql_fetch_array($result)) { {echo "<form action=\"email.php\" method=\"post\">"; echo "<table border=\"1\"><tr><td valign=\"top\" class=\"tdeight\">"; echo "<p>From <br> <input NAME=\"name\" value=\"Bonnie Bruno\" size=\"30\"></p>"; echo "<P> E-Mail Address<br><input NAME=\"email\" size=\"30\" value=\"$record[email];\"</p>"; echo "<p>Subject<br> <input NAME=\"subject\" size=\"30\"</p>"; echo "<p>Comments<br> <textarea name=\"comments\" rows=\"10\" cols=\"30\" ></textarea></p>"; echo "<center><input type=\"submit\" Value=\"Send\" name=\"submit\"><input type=\"reset\" value=\"Reset\" name=\"reset\"></center>"; echo "</td></tr></table>"; echo "</form>"; } } } ?> Can anyone point in the right direction where it will be just one form and all the email addresses go into the form field of email. Thank you for your time. Quote Link to comment https://forums.phpfreaks.com/topic/42117-solved-echo-email-form-is-in-a-loop/ Share on other sites More sharing options...
nloding Posted March 10, 2007 Share Posted March 10, 2007 Just make the while loop output the value of the textbox: <?php //beginning form stuff here echo "<p>E-Mail Address<br><input NAME=\"email\" size=\"30\" value="; while($record = mysql_fetch_array($result)) { echo $record['email'] . ","; } echo "></p>"; //rest of form stuff ?> Quote Link to comment https://forums.phpfreaks.com/topic/42117-solved-echo-email-form-is-in-a-loop/#findComment-204297 Share on other sites More sharing options...
steviemac Posted March 10, 2007 Author Share Posted March 10, 2007 That was it. Thank you for your time. Quote Link to comment https://forums.phpfreaks.com/topic/42117-solved-echo-email-form-is-in-a-loop/#findComment-204304 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.