Hello I am building my first website and I have come across this powerful language and I'm having the hardest time getting it to work.
I am building my contact page and I have several email recipients for visitors to send messages to. the issue is that I can't seem to find any information on the code that would allow that to happen and then even when I find codes I can't seem to get them to work when I load the PHP file on to my server... for instance my current code is:
<?php
if (empty($_POST) === false) {
$errors = array();
$FirstName = $_POST['FirstName'];
$LastName = $_POST ['LastName'];
$email = $_POST['email'];
$to = "Garood.Mocombe@M-Fin.com";
$subject = $_POST['subject'];
$message = $_POST['message'];
mail ($to,$subject,$message);
echo "Message Sent!";
}
?>
when I hit send on the page it echos out the entire code as you see it up top.
can anyone give me some ideas on how to fix this? and on the code that would allow me to set up multiple email recipients?
(When you post php code, use the forum's [php][/php] BBCode tags.)
Are there other parts, or is this your entire script?
Is your server configured to recognize this file as a php script (in most cases, the script's filename must end in .php)?
<Div class="WrapperC"><br><br>
<form action="send_contact.php" method="POST">
<h3><b>Contact Us</b></h3>
<p>Please take the time to let us know how we can help you!</p>
<b>First Name:</b> <input type="text" name="FirstName" id="FirstName">
<b>Last Name:</b> <input type="text" name="LastName" id="LastName"></p>
<b>Your EMail:</b> <input type="text" name="email" id="email"><p>
<b>Recipient:</b>
<select name="person">
<option value="Garood.Mocombe@M-Fin.com">Garood Mocombe</option>
<Option value="Linda.Craddock@M-Fin.com">Linda Craddock</option>
<Option value="Info@M-Fin.com">Customer Service</option>
</select><br><br>
<p>Please be detailed as our goal is to provide the highest level of service.</p>
<b>Subject:</b> <input name="subject" type="text" id="subject">
<p></p>
<p><b> Message:<b><br><textarea rows="10" cols="50" name="message">Please Enter Message Here!</textarea><p></p>
my permissions to share html and img is off how do I get that turned on?
So .... you're NOT running this on a webserver?
Originally Posted by traq
Are you running these pages locally or on the net?
/!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade!/!!!\ ereg() is deprecated --- don't use it!
dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket
PHP has to be served by a properly configured web server; that would explain why the code appears as plain text instead of server-rendered output.
/!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade!/!!!\ ereg() is deprecated --- don't use it!
dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket
I was told that my wamp server was good enough to do that so long as it could process PHP is that not correct? I did a test with the "hello world" code and it worked fine.
Bookmarks