<?php
if ($type[$r]=="finding happiness") {$vidlink="http://www.mormonchannel.org/mormonmessages?v=910937379001";}
else {$vidlink="http://www.lds.org";}
?>
later, in other php page, i have this..
<a id='findmore' href="<?php echo $vidlink ?>" target='_blank'><h3>Find out more about <?php echo $type[$r] ?>.</h3></a>
even when i know the value of $type[$r] IS "finding happiness" it always goes to lds.org. No syntax errors seem to be cropping up so what am I missing? Thanks.
Unless that "other php page" is included/required by the original script (or vice versa), then the 2nd script has no knowledge of any variable assignments in the first. If that's the issue, then you may want to look at using session variables. If that's not the issue, then you may need to do more debugging to verify what values are being set and if/when they are getting overridden.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
You might do a print_r on $r, $type[$r] and $vidlink, just after setting in the first block, and just before the anchor in the second block, to make sure they're all as expected. Somewhere, they're not.
maybe trim() the value being checked in the if() statement, in case there are any white-space characters at either end?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks