Page 1 of 1

variable from variable question

Posted: Fri Feb 04, 2005 11:22 am
by Naughtyboy
I have a form that people can select an person to send a message to. The form field is the persons name.

In my php I want to have the persons address selected based on their name. So, if bob is selected the email goes to bob@bobsdomain.com and so forth. Right now the email will send to the first selection but not to the rest. Any ideas?

Code: Select all

if ($RvpName == 'bob') {
$Recipient ==  'bob@bobsdomain.com';
}  elseif ($RvpName == 'fred') {
$Recipient ==  'fred@someotherdomain.com';
}

Posted: Fri Feb 04, 2005 11:31 am
by feyd
are you sure it comes across as 'fred' ?

Posted: Fri Feb 04, 2005 11:41 am
by Naughtyboy
yes the selection is made from a dropdown menu with the value being fred.

Posted: Fri Feb 04, 2005 11:44 am
by feyd
please post the form doing the submission.

do you have register_globals on?

Code: Select all

<?php
echo 'register_globals are ' . (ini_get('register_globals') ? 'on' : 'off');
?>
will tell you.

Posted: Fri Feb 04, 2005 11:46 am
by Naughtyboy
register globals is on

Code: Select all

<select name="RvpName">
          <option value="bob" selected>bob</option>
          <option value="fred">fred</option>
          </select>

Posted: Fri Feb 04, 2005 11:52 am
by feyd
if this form posting or getting? var_export($_POST) or var_export($_GET) should show you what information was submitted, it may be coming across different than you think..

Posted: Fri Feb 04, 2005 12:02 pm
by Naughtyboy
it is posting and comig across as it should. Perhaps it is an error with the email.

Posted: Fri Feb 04, 2005 3:16 pm
by voltrader
echo the $Recipient after the if/then clause and then choose fred. What do you get?