starvator Posted June 12, 2009 Share Posted June 12, 2009 hello everybody, i am trying to make a newsletter script and i have the form and mysql part working. Now, i need to make the actual email part. <?php //define the receiver of the email $to = '[email protected]'; //define the subject of the email $subject = 'Test email'; //define the message to be sent. Each line should be separated with \n $message = "hello \n how are you? "; //define the headers we want passed. Note that they are separated with \r\n $headers = "From: [email protected]\r\nReply-To: [email protected]"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; ?> this is the php code i have so far, which will send the email. I now need to make another form which submits its contents to here: I need a subject box body box and it needs to select the email addresses in my mysql table does anyone have anyidea how to do this? do i use the get and post codes? thanks Link to comment https://forums.phpfreaks.com/topic/161928-solved-include-function-in-php/ Share on other sites More sharing options...
.josh Posted June 12, 2009 Share Posted June 12, 2009 data sent from a form will either be in the $_GET array or $_POST array, depending on the method you used in your form. So for example if your form method is post and you have a textfield named subject, the posted info will be in $_POST['subject'] Link to comment https://forums.phpfreaks.com/topic/161928-solved-include-function-in-php/#findComment-854372 Share on other sites More sharing options...
robert_gsfame Posted June 12, 2009 Share Posted June 12, 2009 just create a form like <form action = blabla.php method = POST name =blabla> <input type = text name = subject> <input type = text name = body> </form> call those using $_POST $subject = $_POST['subject'] $body = $_POST['body'] is it what you mean? Link to comment https://forums.phpfreaks.com/topic/161928-solved-include-function-in-php/#findComment-854400 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.