variable from variable question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Naughtyboy
Forum Newbie
Posts: 7
Joined: Fri Feb 04, 2005 8:27 am

variable from variable question

Post 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';
}
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

are you sure it comes across as 'fred' ?
Naughtyboy
Forum Newbie
Posts: 7
Joined: Fri Feb 04, 2005 8:27 am

Post by Naughtyboy »

yes the selection is made from a dropdown menu with the value being fred.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Naughtyboy
Forum Newbie
Posts: 7
Joined: Fri Feb 04, 2005 8:27 am

Post by Naughtyboy »

register globals is on

Code: Select all

<select name="RvpName">
          <option value="bob" selected>bob</option>
          <option value="fred">fred</option>
          </select>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
Naughtyboy
Forum Newbie
Posts: 7
Joined: Fri Feb 04, 2005 8:27 am

Post by Naughtyboy »

it is posting and comig across as it should. Perhaps it is an error with the email.
User avatar
voltrader
Forum Contributor
Posts: 223
Joined: Wed Jul 07, 2004 12:44 pm
Location: SF Bay Area

Post by voltrader »

echo the $Recipient after the if/then clause and then choose fred. What do you get?
Post Reply