strujillo Posted September 19, 2008 Share Posted September 19, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/124897-that-is-i-give-up-stupid-php-and-css-please-help/ Share on other sites More sharing options...
Maq Posted September 19, 2008 Share Posted September 19, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/124897-that-is-i-give-up-stupid-php-and-css-please-help/#findComment-645345 Share on other sites More sharing options...
kenrbnsn Posted September 19, 2008 Share Posted September 19, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/124897-that-is-i-give-up-stupid-php-and-css-please-help/#findComment-645347 Share on other sites More sharing options...
strujillo Posted September 19, 2008 Author Share Posted September 19, 2008 Yeah there is a folder called housekeeping. But every time i try and include the entire menu.html path it wont work. I start with C:\xampp\htdocs\si\onikz\housekeeping\menu.html Quote Link to comment https://forums.phpfreaks.com/topic/124897-that-is-i-give-up-stupid-php-and-css-please-help/#findComment-645370 Share on other sites More sharing options...
Maq Posted September 19, 2008 Share Posted September 19, 2008 Post the dir paths of both: 1) The script that is calling menu.html 2) menu.html. itself Quote Link to comment https://forums.phpfreaks.com/topic/124897-that-is-i-give-up-stupid-php-and-css-please-help/#findComment-645374 Share on other sites More sharing options...
keyurshah Posted September 19, 2008 Share Posted September 19, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/124897-that-is-i-give-up-stupid-php-and-css-please-help/#findComment-645431 Share on other sites More sharing options...
keyurshah Posted September 19, 2008 Share Posted September 19, 2008 Correction: Path across the site for menu.html will be: include ($ROOT_URL."/onikz/menu.html"); Quote Link to comment https://forums.phpfreaks.com/topic/124897-that-is-i-give-up-stupid-php-and-css-please-help/#findComment-645503 Share on other sites More sharing options...
discomatt Posted September 19, 2008 Share Posted September 19, 2008 This seems more like a PEBCAK issue than a PHP/CSS one. Quote Link to comment https://forums.phpfreaks.com/topic/124897-that-is-i-give-up-stupid-php-and-css-please-help/#findComment-645561 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.