Jump to content

That is i give up! Stupid PHP and CSS!!! PLEASE HELP!!!


Recommended Posts

So it wont include menu.html

 

No matter how i type it in it keeps returning an error

 

Warning: include(menu.html) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\SI\onikz\email\index.php on line 28

 

Heres the code...its the email function that retrieves the message.

<?php
//This code checks to make sure they are logged in BEFORE they can access the webpage
session_start();
if(!isset($_SESSION['myusername'])){
//If he is not logged in, go to index.php
header("location:/SI/onikz/index.php");
}else{
//If he is logged in do nothing and go on to the rest of the code.
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Email</title>
<link rel="stylesheet" href=".housekeeping/css.css"  type="text/css" media="screen"  />
<body>

<div id="content">
	<?php
	 email(); //Calls the email function


?>
</div>
<?php
//This adds the menu tot he program
include("menu.html"); 
?>
</body>
</html>

<?php
function email(){
	buttons();
}

function buttons(){
	echo "<center><form mehtod=\"get\"><input type=\"submit\" value=\"Inbox\" name=\"inbox\" />";
	echo "<input type=\"submit\" value=\"Outbox\" name=\"outbox\" />";
	echo "<input type=\"submit\" value=\"Compose\" name=\"compose\" /></form></center>";

	if(isset($_GET["inbox"])){
		inbox();
	}
	if(isset($_GET["outbox"])){
		outbox();
	}
	if(isset($_GET["compose"])){
		compose();
	}
	return ;
}

function inbox(){
	include('/xampp/htdocs/SI/onikz/dbconnect.php');

		$username=$_SESSION["myusername"];
		//This selects the message where it has not been read alread, thats why it only pick
		//the messages with stats to 0
		$sql ="SELECT * FROM `abhsoc`.`email` WHERE `to`='$username'"; 

		$result=mysql_query($sql);
		$count=1;
		while($row = mysql_fetch_array($result)){

		$to = $row[to];
		$from=$row[from];
		$subject=$row[subject];
		$message=$row[message];
		$id=$row[id];
			if($to == $username){
			echo"<table><tr>";
			echo"<td><a href=\"inbox.php?id=$id\">View</a></td><td>$from</td><td>$subject</td>";
			echo"</table>";

			}

		}
}

function outbox(){
	include('/xampp/htdocs/SI/onikz/dbconnect.php');

		$username=$_SESSION["myusername"];
		//This selects the message where it has not been read alread, thats why it only pick
		//the messages with stats to 0
		$sql ="SELECT * FROM `abhsoc`.`email` WHERE `from`='$username'"; 

		$result=mysql_query($sql);
		$count=1;
		while($row = mysql_fetch_array($result)){

		$to = $row[to];
		$from=$row[from];
		$subject=$row[subject];
		$message=$row[message];
		$id=$row[id];

			echo "<center>";
			echo "<table border=\"1\" cellpadding=\"5\" width=\"400px\">";
				echo "<td></td>";
				 echo "<th rowspan\"3\"> Email Number " .$count." </th>";
				echo "<tr>";
					echo "<th scope=\"row\" width=\"50px\">From</th>";
				echo "<td>$from</td>";
				echo "</tr>";
				echo "<tr>";
					echo "<th scope=\"row\" width=\"50px\">Subject</th>";
					echo "<td>$subject</td>";
				echo "</tr>";
				echo "<tr>";
					echo "<th scope=\"row\" width=\"50px\">Message</th>";
					echo "<td>$message</td>";
				echo "</tr>";
				echo "<tr></tr>";
			echo "</table>";
			echo "</center>";
			$count++;}
		}


function compose(){
	echo "<center>";
	echo "<form action=\"sendmail.php\" method=\"post\" name=\"email\">";
		echo "<table>";
		echo "<tr>";
				echo "	<td>To:</td>";
				echo "<td><input  name=\"to\" type=\"text\" size=\"50\" maxlength=\"70\" /></td>";
			echo "	</tr>";
			echo "	  <tr>";
			echo "		<td>Subject</td>";
			echo "		<td><input name=\"Subject\" type=\"text\" size=\"50\" maxlength=\"70\" /><br /></td>";
			echo "	  </tr>";
			echo "	  <tr>";
			echo "		<td>Message</td>";
			echo "		<td><textarea name=\"Message\" cols=\"38\" rows=\"5\"></textarea></td>";
			echo "	  </tr>";
			echo "	  <tr>";
			echo "		<td>Options</td>";
			echo "		<td><input name=\"send\" type=\"submit\" value=\"Send\" /></td>";
			echo "	  </tr>";
		echo "	</table>";
	echo "</form>";
	echo"</center>";
}
?>

 

 

Also, it wont include the CSS file! With the link tag. If i put the entire css code into the program it displays it correct but i dont want it like that. Also When i plug in the entire menu.html code into the program instead of using the include() function, it still wont work. It works with all the other pages its just this one that is being dumb...Cry

Make sure you're using the correct dir path.  Obviously it's pointing to the wrong folder.  Wherever your file is located is where you have to navigate from...  Post the whole dir path where your menu.html is and where the file you call it is located.

Unless you have a directory named ".housekeeping", your script won't find the css file, you probably want:

<link rel="stylesheet" href="./housekeeping/css.css"  type="text/css" media="screen"  />

or

<link rel="stylesheet" href="housekeeping/css.css"  type="text/css" media="screen"  />

 

As for you include problem. The error message is telling you what's wrong -- it can't find the file you want to include. Is it in the same directory as the script?

 

Ken

 

 

Assuming that 'si' is your root directory.

 

$ROOT_URL =$_SERVER["DOCUMENT_ROOT"]."/si"; 

Now your $ROOT_URL will be C:/xampp/htdocs/si

 

Suppose your menu.html sits in C:\xampp\htdocs\si\onikz

Now your include path across the site for menu.html will be:

 

include ($ROOT_URL."/si/onikz/menu.html");

 

Hope this helps.

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.