php dropdown
Posted: Sun Jan 22, 2006 12:38 pm
hawleyjr | Please use
//then the rest is the layout and submitting part of the form
thanks asiddle423
hawleyjr | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
hi can anyone help me with my php email form, it is to change the email address when selected from a dropdown menu
to view what i have been testing go onto http://www.jarcodesigns.co.uk/contactform.php
currently i have this codeCode: Select all
//from line 139
if ($_POST['Submit'])
{
//set variables
$name = $_POST['name'];
$email = $_POST['email'];
$ip = $_SERVER['REMOTE_ADDR'];
$message = $_POST['message'];
//if-else statements
if ($department[$key] == 1)
{
$emailaddress = 'xxxx1@jarcodesigns.co.uk';
}
else if ($department[$key] == 2)
{
$emailaddress = 'xxxx2@jarcodesigns.co.uk';
}
else if ($department[$key] == 3)
{
$emailaddress = 'xxxx3@jarcodesigns.co.uk';
}
else if ($department[$key] == 4)
{
$emailaddress = 'xxxx4@jarcodesigns.co.uk';
}
else if ($department[$key] == 5)
{
$emailaddress = 'xxxx5@jarcodesigns.co.uk';
}
$subject = "Contact JARCO";
mail($emailaddress, $subject,"Senders Name: $name <p>Senders Mail: $email </p><p>Their Ip: $ip </p><p>Their Message: $message</p>");
echo $emailaddress;
}
else
{
?>
//this then goes through my form layout and reachs my array code
//line 193
<?
$department = array(
1 => "Web Design (Ryan Norton)",
2 => "Multimedia (Joe Groves)",
3 => "Photography (Oliver Brayford)",
4 =>"Scripting (Andrew Siddle)",
5 => "Logo Design (Andrew Figg)",
);
$department = str_replace(" ", " ", $department);
echo '<select name=department>';
foreach($department as $key => $value)
{
echo '<option value='.$value.'> '.$value.'';
}
echo '</select>';
?>thanks asiddle423
hawleyjr | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]