• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP help needed

<?
if(empty($sessionregion)) {
$regiondropquery=" <option value=\"\">Select Region</option>
<option value=\"17\">Region 17</option>
<option value=\"18\">Region 18</option> ";
} else {
$regiondropquery=" <option>Select Region</option> <option value=\"$sessionregion_id\">$sessionregion</option> ";
}
?>

EDIT: Also, this will get much more attention if it were posted in Programming
 
You're also going to have to make sure that $sessionregion has the option of being able to have been filled. I don't know if this is part of a script or if this is just the beginning of a script..

So if you're getting the data for $sessionregion from a database and that is done earlier in a script then you're fine. But if you're just using this as the beginning script, it will always return true ($sessionregion is empty = true b/c nothing is in the variable). So if you're still running into problems, post the whole thing so we can look at it and help you out.

Also, when you're using double quotes (") for your strings, you have to escape (\") your double quotes within the string, otherwise it will close your string and it will at least not run properly, and at most error out on you.

Then when you're using variables within double quoted strings (" instead of ') you can just use the variable as is within the string. PHP automatically parses the string looking for those when you're using that syntax. But when you use single quotes (') for your string it will just print the string as is.

e.g.

<?
$number = 6;

echo "this is the number: $number"; //echos "this is the number: 6"
echo 'this is the number: $number'; //echos "this is the number: $number"
?>

See the difference?
 
Back
Top