Jump to content

How do I echo include?


bgbs

Recommended Posts

I'm using this php echo code and in the last <li> that is empty right now I'm trying to include a file.

 

echo "<ul>";
			echo "<li><a href=\"index.php#$ad\">Trade Floor</a></li>";
			echo "<li><a href=\"user.php?v_id=$toid\">My Account</a></li>";
			"<li></li>";
			echo "</ul>";

This is the code below with the include and some more code below that I'm trying to put into echo.  Maybe using echo is not the best way in this case, all help and suggestions appreciated.

 

 

include 'inc.last_search.php'

			$toName = ""
			$toEmail = ""
			$fromName = ""
			$fromEmail = ""
			$emailSubj = ""
			$emailBody = ""
			$emailSent = "yes"

Link to comment
https://forums.phpfreaks.com/topic/192647-how-do-i-echo-include/
Share on other sites

include and echo don't work that way. All include does is more or less take the code from the file you include, and plop it wherever the include line was in your program. If you want to echo stuff from an include file, then echo it directly inside the include file

include and echo don't work that way. All include does is more or less take the code from the file you include, and plop it wherever the include line was in your program. If you want to echo stuff from an include file, then echo it directly inside the include file

include and echo don't work that way. All include does is more or less take the code from the file you include, and plop it wherever the include line was in your program. If you want to echo stuff from an include file, then echo it directly inside the include file

 

Ok so help me out, how do I code this correctly?

Will this work fine then?

 

                          echo "<ul>";

echo "<li><a href=\"index.php#$ad\">Trade Floor</a></li>";

echo "<li><a href=\"user.php?v_id=$toid\">My Account</a></li>";

include "inc.last_search.php";

 

$toName = "";

$toEmail = "";

$fromName = "";

$fromEmail = "";

$emailSubj = "";

$emailBody = "";

$emailSent = "yes";

echo "</ul>";

 

 

Put that piece of code that you want to echo in a separate php script -

 

then do an if statement

if( $a == $b)

{

include("script_with_echo.php");

}

else

{

include("another_script_with_echo.php");

}

 

Obviously the if statement will be made to what ever condition you are wand to set- I just used $a == $b as an example.

 

Does that give you an idea to build upon?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.