seany123 Posted April 14, 2009 Share Posted April 14, 2009 basically i have a page which displays a bar using tables... this is a tiny part of it.. <?php if($player->nerve / $player->maxnerve * 100 == 0) { echo"<tr>"; echo"<td width=\"20%\" style=\"font-size: 10px;\" height=\"1\">\n"; echo"<font size=\"3\" color=\"#FFFFFF\">Nerve: </font></td>\n"; echo"<td width='80%' title='" . number_format($player->nerve) . " / " . number_format($player->maxnerve) . " [" . $nervepercent . "%]' height='19'>\n"; echo"<table width=\"100%\" height=\"10px\" style=\"border: 1px solid #555;\"><tr>\n"; echo"<td width=\"0%\" style=\"background-color: #FF0000;\"></td>\n"; echo"<td width=\"100%\" style=\"background-color: #333;\"></td>\n"; echo"</tr>\n"; echo"</table>\n"; echo"</td>\n"; echo"</table>\n"; } ?> <?php if($player->nerve / $player->maxnerve * 100 == 1) { echo"<tr>"; echo"<td width=\"20%\" style=\"font-size: 10px;\" height=\"1\">\n"; echo"<font size=\"3\" color=\"#FFFFFF\">\"Nerve:\"</font></td>\n"; echo"<td width='80%' title='" . number_format($player->nerve) . " / " . number_format($player->maxnerve) . " [" . $nervepercent . "%]' height='19'>\n"; echo"<table width=\"100%\" height=\"10px\" style=\"border: 1px solid #555;\"><tr>\n"; echo"<td width=\"1%\" style=\"background-color: #FF0000;\"></td>\n"; echo"<td width=\"99%\" style=\"background-color: #333;\"></td>\n"; echo"</tr>\n"; echo"</table>\n"; echo"</td>\n"; echo"</table>\n"; } ?> <?php if($player->nerve / $player->maxnerve * 100 == 2) { echo"<tr>"; echo"<td width=\"20%\" style=\"font-size: 10px;\" height=\"1\">\n"; echo"<font size=\"3\" color=\"#FFFFFF\">Nerve:</font></td>\n"; echo"<td width='80%' title='" . number_format($player->nerve) . " / " . number_format($player->maxnerve) . " [" . $nervepercent . "%]' height='19'>\n"; echo"<table width=\"100%\" height=\"10px\" style=\"border: 1px solid #555;\"><tr>\n"; echo"<td width=\"2%\" style=\"background-color: #FF0000;\"></td>\n"; echo"<td width=\"98%\" style=\"background-color: #333;\"></td>\n"; echo"</tr>\n"; echo"</table>\n"; echo"</td>\n"; echo"</table>\n"; } ?> now is it possible to use some kind of Include("bar.php"); or something so it echos the results on a new page? basically show it shows the bar. Quote Link to comment https://forums.phpfreaks.com/topic/154076-echoing-off-other-pages/ Share on other sites More sharing options...
premiso Posted April 14, 2009 Share Posted April 14, 2009 Did you try it? Quote Link to comment https://forums.phpfreaks.com/topic/154076-echoing-off-other-pages/#findComment-809879 Share on other sites More sharing options...
seany123 Posted April 14, 2009 Author Share Posted April 14, 2009 i didnt think just having include("bar.php"); would actually display anything.. Quote Link to comment https://forums.phpfreaks.com/topic/154076-echoing-off-other-pages/#findComment-809881 Share on other sites More sharing options...
premiso Posted April 14, 2009 Share Posted April 14, 2009 Well give it a try. As long as bar.php is in the directory and actually has code in it, it should process it. I would highly suggest trying stuff instead of just posting and asking. You will find that your question will be answered about 10 time quicker and it will save you and everyone else time. If you want to program you have to try stuff out yourself sometimes. You will not die by trying it out, I promise. And PHP, as far as I know, does not bite...at least very hard. Quote Link to comment https://forums.phpfreaks.com/topic/154076-echoing-off-other-pages/#findComment-809885 Share on other sites More sharing options...
seany123 Posted April 14, 2009 Author Share Posted April 14, 2009 i tried it.. it didnt echo anything Quote Link to comment https://forums.phpfreaks.com/topic/154076-echoing-off-other-pages/#findComment-809891 Share on other sites More sharing options...
Axeia Posted April 14, 2009 Share Posted April 14, 2009 Trying putting something outside the if statements to see whether it's the if statements messing up or the include. Quote Link to comment https://forums.phpfreaks.com/topic/154076-echoing-off-other-pages/#findComment-809893 Share on other sites More sharing options...
Psycho Posted April 14, 2009 Share Posted April 14, 2009 All of your echo statements are within IF conditions. All of them must have resulted in false. When you use an include() it is basically the same as if you had copied and pasted the code from the included file into the original file at the location of the include. It's not a difficult concept. file1.php <?php echo "Hello"; include('file2.php'); echo "World"; ?> file2.php <?php echo " Foo Bar "; ?> The output from accessing page1.php would be Hello Foo Bar World Quote Link to comment https://forums.phpfreaks.com/topic/154076-echoing-off-other-pages/#findComment-809904 Share on other sites More sharing options...
seany123 Posted April 14, 2009 Author Share Posted April 14, 2009 okay i see what you mean... ill have a look into it. Quote Link to comment https://forums.phpfreaks.com/topic/154076-echoing-off-other-pages/#findComment-809938 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.