Rabbar Posted January 21, 2008 Share Posted January 21, 2008 Hello I really need a little help with this <?php (nothing important here) HERE I NEED HELP!!! if ($bla == "blabla") """then I want to open "first file.php" in the iframe""" else """then I want to open "second file.php" in the iframe""" } ?> <iframe src="???" name="mainframe" height="600px" width="800px"> </iframe> Can someone please help me with this? Quote Link to comment Share on other sites More sharing options...
aebstract Posted January 21, 2008 Share Posted January 21, 2008 if ($bla == blabla) { open first file } else { open second file } Quote Link to comment Share on other sites More sharing options...
Rabbar Posted January 21, 2008 Author Share Posted January 21, 2008 No... I want to open the file in the iframe not just open it in new window or something. if ($bla == "blabla") """then I want to open "first file.php" in the iframe""" else """then I want to open "second file.php" in the iframe""" <iframe src="" name="mainframe" height="600px" width="800px"> </iframe> Quote Link to comment Share on other sites More sharing options...
Aeglos Posted January 21, 2008 Share Posted January 21, 2008 <?php if ($bla == 'blabla') { $file = 'file1.php' } else { $file = 'file2.php' } ?> <iframe src="<?php echo $file ?>" name="mainframe" height="600px" width="800px"> </iframe> Quote Link to comment Share on other sites More sharing options...
themistral Posted January 21, 2008 Share Posted January 21, 2008 What about if (blah == blah) { $content = 'path/to/file1.php'; } else { $content = 'path/to/file2.php'; } <iframe src="<?php echo $content;?>" name="mainframe" height="600px" width="800px"> </iframe> Quote Link to comment Share on other sites More sharing options...
Rabbar Posted January 21, 2008 Author Share Posted January 21, 2008 LIKE THIS IT DOES NOT WORK <?php if ($bla == 'blabla') { $file = 'file1.php' } else { $file = 'file2.php' } ?> <iframe src="<?php echo $file ?>" name="mainframe" height="600px" width="800px"> </iframe> This way it works <?php $file = 'file.htm' ?> <iframe src="<?php echo $file ?>" name="mainframe" height="600px" width="800px"> </iframe> So when the """if ($bla == 'blabla')""" It does not work Quote Link to comment Share on other sites More sharing options...
Rabbar Posted January 21, 2008 Author Share Posted January 21, 2008 I want to change this "if ($two_letter_country_code == "IS")include('careframe.is.htm'); else include('careframe.en.htm');" To This "if ($two_letter_country_code == "IS") """OPEN """careframe.is.htm""" IN IFRAME""" AND else """OPEN """careframe.en.htm""" IN IFRAME""" "The code" <?php $IPaddress=$_SERVER['REMOTE_ADDR'];$two_letter_country_code=iptocountry($IPaddress);function iptocountry($ip) {$numbers = preg_split( "/\./", $ip);include("ip_files/".$numbers[0].".php");$code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);foreach($ranges as $key => $value){if($key<=$code){if($ranges[$key][0]>=$code){$two_letter_country_code=$ranges[$key][1];break;}}} if ($two_letter_country_code == "IS")include('careframe.is.htm'); else include('careframe.en.htm'); } ?> <body> <td width="79%" align="center" valign="middle"> <center> <iframe src="" name="mainframe" height="600px" width="800px"> </iframe> </center> </td> 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.