?bufhal wrote:yeah it looks red...........................
I wonder why?
Did you figure it out?
Moderator: General Moderators
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Not yet...I am still getting parse error:
Parse error: parse error, unexpected T_IF in /home/attonet/www/atto.net/mail4.php on line 9
Not expert PHP coder and I am not sure of the double quotes....Code: Select all
<?php
$emails = array(
"gz" => "gz@email.com.com",
"dd" => "dd@email.com",
"rpec" => "rpec@email.com",
"mkt" => "mkt@email.com",
)
if (!empty($_GET["email_to"]) && in_array($_GET["email_to"], $emails)) {
if (mail( )) {
echo "Email sent";
exit();
}
}
?>Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]Code: Select all
<?php
$emails = array(
'mkt' => 'mkt@tech.com',
'dd' => 'dd@email.com',
'rpec' => 'gz@tech.com',
'gz' => 'mkt22@tech.com'
);
if (!empty($_GET['email_to']) && in_array($_GET['email_to'], $emails)) {
if (mail( )) {
echo 'Email sent';
exit();
}
}
?>Code: Select all
<form action="mail2.php" method="POST">
<p><b>Subject</b><br>
<input type="text" name="subject" size=50>
<br><br>
<b>Message</b><br>
<textarea cols=40 rows=10 name="message"></textarea><br><br>
<input type="submit" value=" Send ">
</form>Code: Select all
<?php
/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$email = $HTTP_POST_VARS['email'];
$subject = $HTTP_POST_VARS['subject'];
$message = $HTTP_POST_VARS['message'];
/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($emails,$subject,$message)) {
echo "<h3>Thank you for sending email</h3>";
} else {
echo "<h4>Can't send email to $email</h4>";
}
?>Code: Select all
[/php ] tags so we can read it easier? :)
Example:
[syntax=php]Blah blah usual post nonsense explaining problem
[php]<?php
$your_php = "code here";
?>