Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/154076-echoing-off-other-pages/
Share on other sites

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.

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.