Jump to content

Juanita

Members
  • Posts

    7
  • Joined

  • Last visited

Juanita's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. If I had the time to go through the manuels then I definitely would. I really want to learn PHP, but right now it's crunch time at work and so I just need to code this last bit for this site that I'm trying to hurry up and get out there on the web. That's why I'm just wanting to speak code right now and not read through everything. I've been searching for bits and pieces of code online and I've been trying to figure the rest out on my own. The only reason why I said coding seems like some big secret is because wants you start dealing with server side coding everyone wants to be a professor. That's all well and good if I wasn't running out of time. Right now I just need to get straight to the point. Because I don't know PHP I've been searching for some weeks now, on top of trying to get emails to even send to the work email from a contact form through our hosting server. I appreciate all the help. :-)
  2. if(mail($to_add,$subject,$message,$headers)) { if(array_key_exists($_POST['dropdown'])) { $msg = "Mail sent OK"; } } else { $msg = "Error sending email!"; } As soon as I ran the script in a browser it said 'Error sending email.'
  3. This is exactly what I'm trying to figure out. Thank you for the help thus far.
  4. So because I'm a newbie with this can anyone actually guide me with code. You don't have to give it away because I know coding is a big secret of sorts, but just guide me in the right direction with code. That would be wonderful.
  5. You've been wonderful. Thanks bunches.
  6. I've seen folks use $emailAddresses or $emails. Would that work instead?
  7. Hi guys, I'm trying to work this out on my own, but I'm running out of time to figure this out and my PHP skills are newbie level. Here's the deal, I'm creating a contact form that has a drop down box with multiple contacts. I tested to make sure that I can send an actual email to my email address, so that's no problem. It worked just fine after going through hoops of getting that to work. The issue is that it was only 1 email address. I need this to work for multiple email addresses. This is the test code I was using: <?php $msg=""; if(isset($_POST['submit'])) { $from_add = "default@123.com"; $to_add = "default@456.com"; $subject = "Test Subject"; $message = "Test Message"; $headers = "From: $from_add \r\n"; $headers .= "Reply-To: $from_add \r\n"; $headers .= "Return-Path: $from_add\r\n"; $headers .= "X-Mailer: PHP \r\n"; /*?> [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. ;sendmail_from = me@example.com ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ;sendmail_path =<?php */ if(mail($to_add,$subject,$message,$headers)) { $msg = "Mail sent OK"; } else { $msg = "Error sending email!"; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Test form to email</title> </head> <body> <?php echo $msg ?> <p> <form action='<?php echo htmlentities($_SERVER['PHP_SELF']); ?>' method='post'> </form> </p> </body> </html> Now I was thinking that I would just be able to add the email array to $to_add using something like this, but clearly I'm messing up because it keeps displaying the error before I even hit the submit button: <?php $msg=""; if(isset($_POST['submit'])) { $from_add ='default@123.com' $to_add = array('choice 1' => 'default@1234.com', 'choice 2' => default2@1234.com'); $subject = "Test Subject"; $message = "Test Message"; $headers = "From: $from_add \r\n"; $headers .= "Reply-To: $from_add \r\n"; $headers .= "Return-Path: $from_add\r\n"; $headers .= "X-Mailer: PHP \r\n"; /*?> [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. ;sendmail_from = me@example.com ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ;sendmail_path =<?php */ if(mail($to_add,$subject,$message,$headers)) { if(array_key_exists($_POST['dropdown'])) { $msg = "Mail sent OK"; } } else { $msg = "Error sending email!"; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Test form to email</title> </head> <body> <?php echo $msg ?> <p> <form action='<?php echo htmlentities($_SERVER['PHP_SELF']); ?>' method='post'> <select name='dropdown' method="post"> <option value=''>Please Choose Dept.</option> <option value='choice 1'>Boating</option> <option value='choice 2'>Camping</option> </select> <input type='submit' name='submit' value='Submit'> </form> </p> </body> </html> Can someone help me out with this please?
×
×
  • 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.