PHP - If On Index.php Or / Show One Page If Not Show Another?
Hi,
I would like to do the following but not sure how. If the you/user is on index.php of http://www.domain.com/ show one page If not show another How would I do this? Thanks Similar TutorialsI want to show a cookie of a referral's username on a sign up page. The link is like this, www.mysite.com/signup?ref=johnsmith. The cookie doesn't show if I go to that url page. But it does show up once I reload the page. So I'm wondering if it's possible to show the cookie the first time around, instead of reloading the page? Here is my code. // This is in the header $url_ref_name = (!empty($_GET['ref']) ? $_GET['ref'] : null); if(!empty($url_ref_name)) { $number_of_days = 365; $date_of_expiry = time() + 60 * 60 * 24 * $number_of_days; setcookie( "ref", $url_ref_name, $date_of_expiry,"/"); } else if(empty($url_ref_name)) { if(isset($_COOKIE['ref'])) { $user_cookie = $_COOKIE['ref']; } } else {} // This is for the sign up form if(isset($_COOKIE['ref'])) { $user_cookie = $_COOKIE['ref']; ?> <fieldset> <label>Referred By</label> <div id="ref-one"><span><?php if(!empty($user_cookie)){echo $user_cookie;} ?></span></div> <input type="hidden" name="ref" value="<?php if(!empty($user_cookie)){echo $user_cookie;} ?>" maxlength="20" placeholder="Referrer's username" readonly onfocus="this.removeAttribute('readonly');" /> </fieldset> <?php }
I am displaying rows from a database onto a page using: while($row=mysql_fetch_array($query)){ echo $row['name']; } I need to figure out how to limit the rows shown to the page to 100. And if there are 100 rows on the page, a link will be displayed at the bottom, that says "Next 100". Then this will display the next 100 rows. Can you give an example how to do this please? Thanks Quesion: Show each movie in the database on its own page, and give the user links in a "page 1, Page 2, Page 3" - type navigation system. Hint: Use LIMIT to control which movie is on which page. I have provided 3 files: 1st: configure DB, 2nd: insert data, 3rd: my code for the question. I would appreciate the help. I am a noob by the way. First set up everything for DB: <?php //connect to MySQL $db = mysql_connect('localhost', 'root', '000') or die ('Unable to connect. Check your connection parameters.'); //create the main database if it doesn't already exist $query = 'CREATE DATABASE IF NOT EXISTS moviesite'; mysql_query($query, $db) or die(mysql_error($db)); //make sure our recently created database is the active one mysql_select_db('moviesite', $db) or die(mysql_error($db)); //create the movie table $query = 'CREATE TABLE movie ( movie_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, movie_name VARCHAR(255) NOT NULL, movie_type TINYINT NOT NULL DEFAULT 0, movie_year SMALLINT UNSIGNED NOT NULL DEFAULT 0, movie_leadactor INTEGER UNSIGNED NOT NULL DEFAULT 0, movie_director INTEGER UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (movie_id), KEY movie_type (movie_type, movie_year) ) ENGINE=MyISAM'; mysql_query($query, $db) or die (mysql_error($db)); //create the movietype table $query = 'CREATE TABLE movietype ( movietype_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, movietype_label VARCHAR(100) NOT NULL, PRIMARY KEY (movietype_id) ) ENGINE=MyISAM'; mysql_query($query, $db) or die(mysql_error($db)); //create the people table $query = 'CREATE TABLE people ( people_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, people_fullname VARCHAR(255) NOT NULL, people_isactor TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, people_isdirector TINYINT(1) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (people_id) ) ENGINE=MyISAM'; mysql_query($query, $db) or die(mysql_error($db)); echo 'Movie database successfully created!'; ?> ******************************************************************** *********************************************************************** second file to load info into DB: <?php // connect to MySQL $db = mysql_connect('localhost', 'root', '000') or die ('Unable to connect. Check your connection parameters.'); //make sure you're using the correct database mysql_select_db('moviesite', $db) or die(mysql_error($db)); // insert data into the movie table $query = 'INSERT INTO movie (movie_id, movie_name, movie_type, movie_year, movie_leadactor, movie_director) VALUES (1, "Bruce Almighty", 5, 2003, 1, 2), (2, "Office Space", 5, 1999, 5, 6), (3, "Grand Canyon", 2, 1991, 4, 3)'; mysql_query($query, $db) or die(mysql_error($db)); // insert data into the movietype table $query = 'INSERT INTO movietype (movietype_id, movietype_label) VALUES (1,"Sci Fi"), (2, "Drama"), (3, "Adventure"), (4, "War"), (5, "Comedy"), (6, "Horror"), (7, "Action"), (8, "Kids")'; mysql_query($query, $db) or die(mysql_error($db)); // insert data into the people table $query = 'INSERT INTO people (people_id, people_fullname, people_isactor, people_isdirector) VALUES (1, "Jim Carrey", 1, 0), (2, "Tom Shadyac", 0, 1), (3, "Lawrence Kasdan", 0, 1), (4, "Kevin Kline", 1, 0), (5, "Ron Livingston", 1, 0), (6, "Mike Judge", 0, 1)'; mysql_query($query, $db) or die(mysql_error($db)); echo 'Data inserted successfully!'; ?> ************************************************************** **************************************************************** MY CODE FOR THE QUESTION: <?php $db = mysql_connect('localhost', 'root', '000') or die ('Unable to connect. Check your connection parameters.'); mysql_select_db('moviesite', $db) or die(mysql_error($db)); //get our starting point for the query from the URL if (isset($_GET['offset'])) { $offset = $_GET['offset']; } else { $offset = 0; } //get the movie $query = 'SELECT movie_name, movie_year FROM movie ORDER BY movie_name LIMIT ' . $offset . ' , 1'; $result = mysql_query($query, $db) or die(mysql_error($db)); $row = mysql_fetch_assoc($result); ?> <html> <head> <title><?php echo $row['movie_name']; ?></title> </head> <body> <table border = "1"> <tr> <th>Movie Name</th> <th>Year</th> </tr><tr> <td><?php echo $row['movie_name']; ?></td> <td><?php echo $row['movie_year']; ?></td> </tr> </table> <p> <a href="page.php?offset=0">Page 1</a>, <a href="page.php?offset=1">Page 2</a>, <a href="page.php?offset=2">Page 3</a> </p> </body> </html> Hi , I know my code sucks but i'm learning fast!! I'm trying to show a form if the qty value in a database == 10 or a different form if the value ==20. I tried but failed. Any help really appreciated. Code: [Select] <?php require_once('Connections/book.php'); ?> <?php $colname_cardpayment = "-1"; if (isset($_GET['orderid'])) { $colname_cardpayment = (get_magic_quotes_gpc()) ? $_GET['orderid'] : addslashes($_GET['orderid']); } mysql_select_db($database_book, $book); $query_cardpayment = sprintf("SELECT * FROM cards WHERE orderid = '%s' ORDER BY qty ASC", $colname_cardpayment); $cardpayment = mysql_query($query_cardpayment, $book) or die(mysql_error()); $row_cardpayment = mysql_fetch_assoc($cardpayment); $totalRows_cardpayment = mysql_num_rows($cardpayment); // Database connect $con = mysql_connect("mysql1.myhost.ie","admin_book","root123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("book_test", $con); //Parse Values from Coupon.php Form $orderid = mysql_real_escape_string(trim($_POST['orderid'])); $name = mysql_real_escape_string(trim($_POST['name'])); $surname = mysql_real_escape_string(trim($_POST['surname'])); $add1 = mysql_real_escape_string(trim($_POST['add1'])); $add2 = mysql_real_escape_string(trim($_POST['add2'])); $town = mysql_real_escape_string(trim($_POST['town'])); $county = mysql_real_escape_string(trim($_POST['county'])); $postcode = mysql_real_escape_string(trim($_POST['postcode'])); $phone = mysql_real_escape_string(trim($_POST['phone'])); $email = mysql_real_escape_string(trim($_POST['email'])); $letterstyle = mysql_real_escape_string(trim($_POST['letterstyle'])); $sql="INSERT INTO custdetails (orderid, name, surname, add1, add2, town, county, postcode, phone, email, letterstyle) VALUES ('$orderid','$name','$surname','$add1','$add2','$town','$county','$postcode','phone','$email','$letterstyle')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Digital Scribe Books</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> </head> <body onload="MM_preloadImages('images/buttons/home_over.png','images/buttons/books_over.png','images/buttons/cards_over.png','images/buttons/letters_over.png')"> <div id="snow"> <div id="wrapper"> <div id="header"> <div id="logo"><img src="images/digital_scripe.png" width="218" height="91" /></div> <div id="menu"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/buttons/home_over.png',1)"><img src="images/buttons/home_act.png" name="Home" width="131" height="132" border="0" id="Home" /></a><a href="books.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Books','','images/buttons/books_over.png',1)"><img src="images/buttons/books_act.png" name="Books" width="131" height="132" border="0" id="Books" /></a><a href="cards.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Cards','','images/buttons/cards_over.png',1)"><img src="images/buttons/cards_act.png" name="Cards" width="131" height="132" border="0" id="Cards" /></a><a href="letters.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Letters','','images/buttons/letters_over.png',1)"><img src="images/buttons/letters_act.png" name="Letters" width="131" height="132" border="0" id="Letters" /></a></div> </div> <div id="content"> <?php echo 'Order ID is : '. $orderid . '.<br />'; if ($row2['qty'] == 10) echo "<div> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="accounts@agraphics.ie"> <input type="hidden" name="lc" value="IE"> <input type="hidden" name="item_name" value="10 Christmas Cards"> <input type="hidden" name="item_number" value="<? echo $orderid; ?>"> <input type="hidden" name="amount" value="12.99"> <input type="hidden" name="currency_code" value="EUR"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="shipping" value="2.99"> <input type="hidden" name="return" value="http://www.digitalscribe/thanks.php"> <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> </div>"; if ($row2['qty'] == 20) echo "<div> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="accounts@agraphics.ie"> <input type="hidden" name="lc" value="IE"> <input type="hidden" name="item_name" value="20 Christmas Cards"> <input type="hidden" name="item_number" value="<? echo $orderid; ?>"> <input type="hidden" name="amount" value="21.99"> <input type="hidden" name="currency_code" value="EUR"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="shipping" value="2.99"> <input type="hidden" name="return" value="http://www.digitalscribe/thanks.php"> <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> </div>"; ?> </div> <div id="footer" class="clear"><div id="sign"><div id="sign_text">Personalised<br /> Books</div> </div></div> </div></div> </body> </html> <?php mysql_free_result($cardpayment); ?> Hi All, I want to be able to show selected pages of my website as PDF using a 'PDF' button much like this site does: http://www.westmeon.org.uk/index.php?option=com_content&task=blogsection&id=8&Itemid=35 I presume that I will need to install some sort of software on my server (which runs the latest PHP, MySQL etc.) but after hours of searching online I cannot find a simple way of doing this. Does anyone have any suggestions or pointers for how I can do this? FYI my website is written in PHP drawing data from a MySQL database. Regards, Neil Hi I want to make something like this - My Sites index.php will be avail avail to user after he has clicked in a link that will come after every 24 Hour in my site. Means when a user first enters the site it will come and clicking in there the site will be avail avail. again after 24 Hour it will come again. But i am not getting how to do it. So need help SaKIB Hi, This may be something for JavaScript but I would like to know if and how it's possible to show who is currently active/viewing the page. Users are logged into the system with their own account. The purpose of this is for a CRM where more than one person may be editing the same record, so undesired overwrites might occur which is what I'd like to avoid with this "other user editing this record" notification. Hi, I want to show part of the text from a page containing my article on my main page. The article resides in a database in mysql. How do I limit the amount of text that is shown without setting up a separate excerpt box for the article. I want to then provide a link so the user can go to another page that displays the entire article. Thanks for any suggestions. I know the php is basic and not completed yet, but I am working on that. My next step I want the result to show on index.php when a form is submitted to calculator2.php. I just cant seem to get it. Please help! index.php Code: [Select] <div class="post"> <h2 class="title">Calculator</h2> <hr /> <form method="post" action="calculator2.php"> Fireplace Front Width: <input type="text" name="fw"> <br /> Fireplace Back Width: <input type="text" name="bw"> <br /> Fireplace Depth: <input type="text" name="fd"> <br /> <input type="submit" name="Submit" value="Submit"> </form> Pounds Of Glass Needed: <?php echo $res1; ?> </div> calculator2.php Code: [Select] <?php $frontwidth = $_POST['fw']; $backwidth = $_POST['bw']; $firedepth = $_POST['fd']; $x = $frontwidth + $backwidth+ $firedepth; $y = ($x / 3) * .6667; $res1 = $y *2; echo $res1; ?> http://2eastvalleyhomes.expandyourwebpresence.com/ In this site on the right widget the search option opens a new page and directs you off the page. I have created a page not visible on the home page called MLS and I would like the search on the right side to have its information populate in a page I created in my wordpress site, does any one have any suggestions or any ideas for this thank you for any help. Hi, okee so I'm new to everything that has to do with scripting, especially when it comes to PHP and stuff, but what is the best way to display information from a table on a page? I'm creating this site where users can post their events, but I want the Location to be based on the Location they inserted during the registration process, so that the location will be displayed directly. How am I able to do that? I've already got an login script, it looks like this: Code: [Select] <?php ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="whats_happening_db"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $myusername and $mypassword $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:membersarea.php?user=$myusername"); } else { echo "Wrong Username or Password"; } ob_end_flush(); ?> Sorry if my English is terrible haha. Dante. Hi im trying to pass a variable through a url. Here's the code : echo"<td class='tableContent'><span onmouseover=\"tooltip.show('Click to add details to ".$result['workObject']."');\" onmouseout=\"tooltip.hide();\"><a href='addRemarksBucc.php?workObject=".$result['workObject']."'>".$result['systemRemarks']."</a></span></td>"; and here's the code to the next page: <table width="550" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="78" valign="top">Work Object</td> <td><input name="workObject" id="workObject" type="text" value="<?php $_GET['workObject']; ?>" /></td> </tr> <tr> <td valign="top">Remark Details</td> <td><textarea name="errorMessage2" cols="50" rows="10" id="errorMessage2" accesskey="p" tabindex="1"></textarea> <input name="workObject2" type="hidden" value="" /></td> </tr> <tr> <td valign="top"> </td> <td> </td> </tr> <tr> <td> </td> <td><input name="submit" type="submit" class="btn" id="submit" accesskey="R" tabindex="11" value="Submit" /> <input name="reset" type="reset" class="btn" id="reset" accesskey="e" tabindex="12" value="Reset" /></td> </tr> </table> What am I doing wrong? The address bar shows the right url but the second page doesn't display any value for workObject. Thanks! I need to come up with a script that will get the number of products under a category and return the number of products shown on each page in Showing 1-20 Products out of (total number) I have this MYSQL which I'm also using to generate pagination. Code: [Select] $query5 = "SELECT COUNT(*) as num FROM $tbl_name WHERE product_category='$cat'"; $total_pages = mysql_fetch_array(mysql_query($query5)); $total_pages = $total_pages[num]; /* Setup vars for query. */ $targetpage = "store.php?cat=".$cat; //your file name (the name of this file) $limit = 20; //how many items to show per page $page = $_GET['page']; if($page){ $start = ($page - 1) * $limit; //first item to display on this page } else{ $start = 0; //if no page var is given, set start to 0 } The products are pulled from the database he Code: [Select] $sql30 = "SELECT * FROM $tbl_name WHERE product_category='$cat' LIMIT $start, $limit"; $result30 = mysql_query($sql30); I came up with one way, but it will only work when there are 20 products on the page. If there's less it won't calculate that amount. Hi I use fake IP to check if my 503 custom error page works but it doesn't?. I have another question should i stop people from hotlinking to my rss feed which is also sitemap? and stop people from hotlinking to my robots.txt?. Thanks
RewriteEngine on Hello, i just install LAMP server. wrote simple code <?php #error_reporting(E_ALL); #printf "hello"; print "print_keyword."; ?>but in browser, it does not show me an error. i m using linux envionment. plz help. any help would be appriciable. Hi All, I am trying to develop an application that show's where PC's are located in an office. Basically, what I want to be able to do, is to overlay avatar-like images over a main floorplan layout, and place them in a position, depending on thier x/y co-ordinates, which would be retreived from a database. Is this possible using PHP at all? Thanks in advance Matt Ok, just another noob problem here while working with PHP + MySQL: I have a php page containing a form which I use to pull the data from mysql database. When the user chooses a value/values from the dropdown lists and clicks submit, the page reloads and displaying the quarry results according to user's selection. When user first loads the php page with form, it shows no data unless he clicks submit. Question: How to show a default quarry value on first page load before user even get to use the form? In other words, I want the user to see the default quarry data pulled from DB on page load before he uses the form to refine the results... I am not sure if its possible, but truly hope so I would appreciate any advice or pointer in the right direction. Please let me know if you need the exact code I am using for my form page. I'm trying to show the same data, but updated right away. For example. I want to update my coords on a map and refresh a div to show the new data, but as the code now, it keeps the same data until I reload the page. Here is the code I have now. if ($north) { $ylocation = $users['y'] + 1; if ($ylocation > 5) { $ylocation = 0; } $locationyupdate = ("UPDATE players SET y = '$ylocation' WHERE name='$users[name]'"); mysql_query($locationyupdate) or die("could not register");?> <script type="text/javascript"> $('#npc').load('npc.php'); $('#description').load('description.php'); </script><?} The update code is before the reload script for the two div's. The data DOES change in the database, but the two div's won't display the new data until it is refreshed again. Do I need to reactivate fetch to get the new data? Hello People. Please can someone point me to where I can learn to program the following all one one page? Here is a screenshot of what I'm after. Idea being that you put hours and minutes into the top row. Then hours and minutes into the next row. Click the button and get the answer at the bottom. The answer to 1 hour 40 minutes added to 1 hour 40 minutes should obviously be 3 hours 20 minutes. Here's how I would approach it in another language, but am brand new to php hence the help required. Make the following variables. Hour1 Hour2 Minute1 Minute2 Total_Hours Total_Minutes Combined_Time I would then write something like Total_minutes = minute1 + Minute2 Total_hours = Hour1 + hour2 combined time = Total_hours * 60 + (Total_Minutes) // reset the total hours Total_hours = 0 Loop here.... while combined_time >60 Total_hours = Total_hours + 1 combined_time = combined time -60 re-do the loop Now in the boxes at the bottom put bottom hour box = total hours bottom minute box = combined_time (remaining minutes) here's the code I have so far. Code: [Select] <!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=UTF-8" /> <title>Untitled Document</title> </head> <body> <table width="527" border="0" cellspacing="5" cellpadding="5" bgcolor="#c0c5c9"> <p>Time Calculator</p> <p>Put your hours and minutes in the top boxes. Click the add time button<br /> to get the answer </p> <table width="401" border="1" cellspacing="5" cellpadding="5"> <tr> <td width="109"><input type="int" name="hour01" size="10" maxlength="10" /> Hrs</td> <td width="251"><input type="int" name="min01" size="10" maxlength="10" /> Mins</td> </tr> <tr> <td><input type="int" name="hour02" size="10" maxlength="10" /> Hrs</td> <td><input type="int" name="min02" size="10" maxlength="10" /> Mins</td> </tr> <tr> <td><input type="submit" name="submit" value="Add Time" /></td> <td><input name="hour_answer" type="int" size="10" maxlength="10" /> Hrs <input type="int" name="minute_answer" size="10" maxlength="10" /> Mins</td> </tr> </table> <tr></tr> </body> </html> I have a page that shows entries in a guestbook I'm making, and below the entries there is supposed to be a form to write an entry. Except, none of the HTML after the script to show the entries shows up on the page. I have no clue what's wrong. Here is the script to show the entries. $n is name, $d is date, $s is site (optional), and $m is message. $file = fopen("posts.txt", 'rb'); flock($file, LOCK_SH); while(!feof($file)){ $entry = fgetcsv($file, 0, '|'); if(empty($entry)){exit;} $d = $entry[1]; $n = $entry[2]; $s = $entry[3]; $m = $entry[4]; echo ' <table style="border: #3399AA 1px solid;"><tr style="background: #3399AA; font: bold 10px verdana,sans-serif; color: #FFFFFF;"> <td width="170">'.$n.'</td> <td align="right" width="170">'.$d.'</td> </tr> '; if($s != 'none'){ echo ' <tr><td colspan="2" style="font: 10px verdana,sans-serif; color: #3399AA;"> <b>Site: </b><a href="'.$s.'">'.$s.'</a> <center><div style="width: 250; height: 1px; background: #3399AA; margin: 10px;"></div></center></td></tr> '; } echo ' <tr> <td colspan="2" style="font: 10px verdana,sans-serif; color: #3399AA;">'.$m.'</td> </tr></table><br> '; } flock($file, LOCK_UN); fclose($file); The file it is reading looks like this: Code: [Select] |11:51 am, 3rd Nov 2010|Memoria|none|Hello. :) |11:51 am, 3rd Nov 2010|Memoria|http://sitehere|Hello again. |11:51 am, 3rd Nov 2010|Memoria|none|How are you doing? Thanks! |