parboy Posted May 24, 2010 Share Posted May 24, 2010 I want to use a conditional statement to determine which include should be used based on whether the statement evaluates true or false. I think it's a matter of syntax but I haven't figured out the correct form. It seems to get more complicated with variables inside the includes. Example: <? if($issue_number=="n") { echo "<?php include 'issues/'."$nl_issue[$nl-1]".'.php'; ?>"; } else { echo <?php include 'issues/'."$nl_issue[$issue_number]".'.php'; ?>"; } ?> Quote Link to comment Share on other sites More sharing options...
marcus Posted May 24, 2010 Share Posted May 24, 2010 Where is $issue_number coming from? <?php if($issue_number == 'n'){ include "file1.php"; }else { include "file2.php"; } ?> Quote Link to comment Share on other sites More sharing options...
-Karl- Posted May 24, 2010 Share Posted May 24, 2010 <? if($issue_number=="n") { Please use full PHP tags in future. Short tags are bad practise. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.