-
hmp smart programming ... that would be where you come in. I was thinking and started doing it by making each phrase an array... and then trying to reference it and i was just going all wrong with it. I will try this snippet and let you know how things work out, if i can even figure this out haha.
-
If you could, show the complete code from head to toes, that would be great, trying to see what im doing right/wrong.
-
PHP Code:
<?
/* The skeleton */
$who = $_POST['who'];
$typeOfInfo = $_POST['typeOfInfo'];
$nameOfWho = array(
1 => "Prospective insured",
"Prospective agent",
"Insured",
"Agent",
"Uknown Person"
);
$nameOfInfo = array(
1 => "Request Claim Information",
"Request information about my policy",
"Request information about obtaining my policy",
"Request my password",
"Comment on your website",
"Contact you on an unlisted topic"
);
$list = array(
"john.doe@mail.com",
"Homer.Sexual@moes.com",
"trustno1@aol.com",
"foo@bar.com",
"blah@the.net",
"president@whitehouse.gov"
);
$typeOfInfoPeople = array(
1=> array("$list[0], $list[2]", NULL, NULL, NULL, $list[5]),
array($list[1], $list[2], NULL, NULL, NULL, $list[5]),
array(NULL, $list[2], NULL, $list[5], NULL, $list[5]),
array(NULL, NULL, NULL, NULL, NULL, $list[5]),
array(NULL, NULL, list[3], NULL, NULL, $list[5]),
array("$list[0], $list[1]",
"$list[0], $list[2]",
"$list[0], $list[3]",
"$list[0], $list[4]",
"$list[0], $list[5]",
"$list[0], $list[1], $list[2], $list[3], $list[4], $list[5]"
);
$post = "$name, a ". $nameOfWho[$who].
" wants to ". $nameOfInfo[$typeOfInfo] .
":
Additional comment was:
$comment\n";
$mailing = $typeOfInfoPeople[$typeOfInfo][$who];
if (!$mailing)
die("We apologize. For the moment, we cannot provide feedback for ". $typeOfWho[$who]);
else {
mail($mailing,
"An information requested",
$post) or die("Mail session failed! The query was not sent, contact the administrator");
?>
the form will change slightly to simplify variables:
Code:
<FORM action="myscript.php" method="post">
<SELECT NAME="who">
<OPTION VALUE="1">Prospective insured</option>
<OPTION VALUE="2">Prospective agent</option>
<OPTION VALUE="3">Insured</option>
<OPTION VALUE="4">Agent</option>
<OPTION VALUE="5" selected="selected">Uknown Person</option>
</SELECT>
<select name="typeOfInfo">
<OPTION VALUE="1">Request Claim Information</option>
<OPTION VALUE="2">Request information about my policy</option>
<OPTION VALUE="3">Request information about obtaining my policy</option>
<OPTION VALUE="4">Request my password</option>
<OPTION VALUE="5">Comment on your website</option>
<OPTION VALUE="6">Contact you on an unlisted topic</option>
</select>
<input type="submit" value="Send query">
</form>
-
should something like this work?
-
Parse error: parse error, unexpected '[', expecting '(' in C:\Inetpub\wwwroot\contactus.php on line 37
37 = array(NULL, NULL, list[3], NULL, NULL, $list[5]),
-
-
lol the error, was not on that line at all, it appears that i dont need the {} on the if/else statement, although it says
We apologize. For the moment, we cannot provide feedback for
... and when the emails do send, it only posts
, a Unknown Person wants to Comment on your website:
Additional comment was:
Hmmm...
-
nope, you only masked the error
-
yes, i did figure the error out, but somereason its not posting ne data... does this script work for you?
i tried over n over again and get the We apologize. For the moment, we cannot provide feedback for error...
-
show me your script and form too