Johnain Posted November 27, 2007 Share Posted November 27, 2007 Hi all In my form indexfr.php I have this code ... <?php $langg ="FR"; include_once($_SERVER['DOCUMENT_ROOT'].'/scripts/inctagline.php'); ?> In my file '/scripts/inctagline.php' I have this code <?php if ($_GET['langg']=="EN"){ echo "<p>Training and supporting the horse and rider.</p>"; } elseif ($_GET['langg']=="FR"){ echo"<p>Formant et soutenant le cheval et le cavalier</p>" ; } else { echo "<p>Training and supporting the horse and rider default</p>" ; } ?> It is picking up the default third line so not readingthe variable value. Can anyone tell me why please? It seems so simple !! ... and by the way ...do I have to put the starting <?php and the ending ?> in the include file? Link to comment https://forums.phpfreaks.com/topic/79095-solved-vriable-not-getting-picked-up-in-an-include/ Share on other sites More sharing options...
Orio Posted November 27, 2007 Share Posted November 27, 2007 Why are you using get? Simply use $langg... Orio. Link to comment https://forums.phpfreaks.com/topic/79095-solved-vriable-not-getting-picked-up-in-an-include/#findComment-400305 Share on other sites More sharing options...
Johnain Posted November 27, 2007 Author Share Posted November 27, 2007 I tried without but no result. At that time I was using case instead of if, I'll try it again now as a pure reference though. Link to comment https://forums.phpfreaks.com/topic/79095-solved-vriable-not-getting-picked-up-in-an-include/#findComment-400307 Share on other sites More sharing options...
Johnain Posted November 27, 2007 Author Share Posted November 27, 2007 That worked absolutely fine. Thanks a lot. It just shows how one cangebogged down and too close. Do I need to put the <?php and the terminating ?> in the include file? Link to comment https://forums.phpfreaks.com/topic/79095-solved-vriable-not-getting-picked-up-in-an-include/#findComment-400312 Share on other sites More sharing options...
trq Posted November 27, 2007 Share Posted November 27, 2007 Do I need to put the <?php and the terminating ?> in the include file? Yes. Link to comment https://forums.phpfreaks.com/topic/79095-solved-vriable-not-getting-picked-up-in-an-include/#findComment-400327 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.