PHP - Pagination Showing To Many Page Links
Similar Tutorialsi have built pages that paginate with 10 rows per page (some pages show more but for the moment i want to focus on this particular page)
//Define Some Options for Pagination $num_rec_per_page=10; if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; }; $start_from = ($page-1) * $num_rec_per_page; $results = mysql_query("SELECT * FROM `ecmt_memberlist` WHERE toonCategory='Capital' AND oldMember = 0 ORDER BY CONCAT(MainToon, Name) LIMIT $start_from, $num_rec_per_page") or die(mysql_error()); $results_array = array(); while ($row = mysql_fetch_array($results)) { $results_array[$row['characterID']] = $row; }The above sets the variables for the pagination and below the results are echo with 10 rows per page then i show the pagination links: <?php $sql = "SELECT * FROM `ecmt_memberlist` WHERE toonCategory='Capital' AND oldMember = 0 ORDER BY CONCAT(MainToon, Name)"; $rs_result = mysql_query($sql); //run the query $total_records = mysql_num_rows($rs_result); //count number of records $total_pages = ceil($total_records / $num_rec_per_page); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><div style="width:100%; text-align:center;"> <ul class="pagination"> <li class="selected"> <?php echo "<a href='capitalmember.php?page=1'>".'«'."</a> ";?> </li> <? for ($i=1; $i<=$total_pages; $i++) { echo "<li><a href='capitalmember.php?page=".$i."'>".$i."</a></li> "; }; ?> <li class="selected"> <? echo "<a href='capitalmember.php?page=$total_pages'>".'»'."</a> "; // Goto last page ?></li> </ul></div> <?php $pageNr = $page; // Get Current Page Number $from = $pageNr * $rowsPerPage; // 3 * 10 = 30 // 3 * 10 = 30 $to = $from + $rowsPerPage; // 30 + 10 = 40 echo $pageNr; /* Result: From page 30 to 40 */ ?></td> </tr> </table>this works great and shows me 10 results per page, what i need to work out and work on next is: echo the number of results above the records (for example: "showing records 1 to 10" and then on page 2 "showing records 11 to 21" and page 3 "showing records 22 to 32" how can i work out the maths for this echo? i was thinking along the lines of; <?php $pageNr = $page; // Gets Current Page Number $from = $pageNr * $rowsPerPage; // 3 * 10 = 30 $to = $from + $rowsPerPage; // 30 + 10 = 40 // Now Show Results echo $from; // Echo from echo $to // Echo to ?>but i'm still working on this.. then i need to look at shortening the amount of page links on the page if for example i have 500 records it shows me links 1 to 50 and eats up the page.... Appreciate any help and light onto my problems. Many thanks Edited by jacko_162, 11 January 2015 - 05:43 PM. Hi guys, I recently wrote a pagination script and it works fine, except from when trying to echo the navigation. This is the Pagination.php Script Code: [Select] <?php class Pagination { /** * Current Page * * @var integer */ var $page; /** * Size of the records per page * * @var integer */ var $size; /** * Total records * * @var integer */ var $total_records; /** * Link used to build navigation * * @var string */ var $link; /** * Class Constructor * * @param integer $page * @param integer $size * @param integer $total_records */ function Pagination($page = null, $size = null, $total_records = null) { $this->page = $page; $this->size = $size; $this->total_records = $total_records; } /** * Set's the current page * * @param unknown_type $page */ function setPage($page) { $this->page = 0+$page; } /** * Set's the records per page * * @param integer $size */ function setSize($size) { $this->size = 0+$size; } /** * Set's total records * * @param integer $total */ function setTotalRecords($total) { $this->total_records = 0+$total; } /** * Sets the link url for navigation pages * * @param string $url */ function setLink($url) { $this->link = $url; } /** * Returns the LIMIT sql statement * * @return string */ function getLimitSql() { $sql = " WHERE school = 'ssb' ORDER BY orientation LIMIT " . $this->getLimit(); return $sql; } /** * Get the LIMIT statment * * @return string */ function getLimit() { if ($this->total_records == 0) { $lastpage = 0; } else { $lastpage = ceil($this->total_records/$this->size); } $page = $this->page; if ($this->page < 1) { $page = 1; } else if ($this->page > $lastpage && $lastpage > 0) { $page = $lastpage; } else { $page = $this->page; } $sql = ($page - 1) * $this->size . "," . $this->size; return $sql; } /** * Creates page navigation links * * @return string */ function create_links() { $totalItems = $this->total_records; $perPage = $this->size; $currentPage = $this->page; $link = $this->link; $totalPages = floor($totalItems / $perPage); $totalPages += ($totalItems % $perPage != 0) ? 1 : 0; if ($totalPages < 1 || $totalPages == 1){ return null; } $output = null; //$output = '<span id="total_page">Page (' . $currentPage . '/' . $totalPages . ')</span> '; $loopStart = 1; $loopEnd = $totalPages; if ($totalPages > 5) { if ($currentPage <= 3) { $loopStart = 1; $loopEnd = 5; } else if ($currentPage >= $totalPages - 2) { $loopStart = $totalPages - 4; $loopEnd = $totalPages; } else { $loopStart = $currentPage - 2; $loopEnd = $currentPage + 2; } } if ($loopStart != 1){ $output .= sprintf('<li class="disabledpage"><a href="' . $link . '">&#171;</a></li>', '1'); } if ($currentPage > 1){ $output .= sprintf('<li class="nextpage"><a href="' . $link . '">Previous</a></li>', $currentPage - 1); } for ($i = $loopStart; $i <= $loopEnd; $i++) { if ($i == $currentPage){ $output .= '<li class="currentpage">' . $i . '</li> '; } else { $output .= sprintf('<li><a href="' . $link . '">', $i) . $i . '</a></li> '; } } if ($currentPage < $totalPages){ $output .= sprintf('<li class="nextpage"><a href="' . $link . '">Next</a></li>', $currentPage + 1); } if ($loopEnd != $totalPages){ $output .= sprintf('<li class="nextpage"><a href="' . $link . '">&#187;</a></li>', $totalPages); } return "<div class='pagination'><ul>" . $output . "</ul></div>"; } } ?> And this is the actual page which needs paginating: Code: [Select] <?php include('Pagination.php'); $page = 1; // how many records per page $size = 9; // we get the current page from $_GET if (isset($_GET['page'])){ $page = (int) $_GET['page']; } // create the pagination class $pagination = new Pagination(); $pagination->setLink("album.php?page=%s"); $pagination->setPage($page); $pagination->setSize($size); $pagination->setTotalRecords($total_records); // now use this SQL statement to get records from your table //$SQL = "SELECT * FROM mytable " . $pagination->getLimitSql(); $myServer = "********"; $myUser = "*******"; $myPass = "*******"; $myDB = "*******"; //connection to the database $dbhandle = mysql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a database to work with $selected = mysql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); $album_query = "SELECT * FROM albums WHERE album_name = '" . $_REQUEST['album'] . "' "; $album_result = mysql_query($album_query) or die('Error Getting Information Requested for album'); $album_row = mysql_fetch_array($album_result); $album = $_REQUEST['album'] . " " . $album_row['school']; $photo_query = "SELECT * FROM `" . $album . "` " . $pagination->getLimitSql(); //$photo_query = "SELECT * FROM `" . $album . "` WHERE school = 'ssb' ORDER BY orientation" . $pagination->getLimitSql(); $photo_result = mysql_query($photo_query) or die('Error Getting Information Requested for photos'); $photo_row = mysql_fetch_array($photo_result); $photo_row_count = mysql_num_rows($photo_result); $i = 0; $cellcnt = 0; while ($i < $photo_row_count) { $thumb_selection = $_REQUEST['album'] . " " . $album_row['school']; $photo_selection = $_REQUEST['album'] . " " . $album_row['school']; if($thumb_selection == "nutcracker 2007 ssb") $act_thumb = mysql_result($photo_result,$i,"thumbnail"); else $act_thumb = mysql_result($photo_result,$i,"thumbnail") . "/" . mysql_result($photo_result,$i,"photo_id") . ".jpg"; if($photo_selection == "nutcracker 2007 ssb") $act_photo = mysql_result($photo_result,$i,"photo_path"); else $act_photo = mysql_result($photo_result,$i,"photo_path") . "/" . mysql_result($photo_result,$i,"photo_id") . ".jpg"; if (!(mysql_result($photo_result,$i,"photo_name") == "")) $photo_name_font_tag = "<font style=' padding: 5px; background-color:grey; font-family: Vag Round, Vag Rounded; color: #C02777;'>"; else $photo_name_font_tag = "<font style='font-family: Vag Round, Vag Rounded; color: #C02777;'>"; $f1 =" <td align='center'> <a class='grouped_elements' rel='group1' href='" . $act_photo . "'><img src='" . $act_thumb . "' /> <br /> " . mysql_result($photo_result,$i,"photo_name") . "</a> </td></font> "; echo "" . $f1 .""; $cellcnt++; if ($cellcnt == 3) { echo "</tr> <tr>"; $cellcnt = 0; } $i++; } ?> </table> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> <?php $navigav = $pagination->create_links(); //$navigav = $pagination -> create_links($output); echo $navigav; ?> Any help would be greatly appreciated! Jacob. Hey guys, I have a PHP pagination script, but for some reason the while looping part that shows each row doesnt show the css styling I have. Here is my code. <?php $tableName="news"; $targetpage = "archive.php"; $limit = 10; $query = "SELECT COUNT(*) as num FROM $tableName"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages['num']; $stages = 3; $page = mysql_escape_string($_GET['page']); if($page){ $start = ($page - 1) * $limit; }else{ $start = 0; } // Get page data $query1 = "SELECT * FROM $tableName LIMIT $start, $limit"; $result = mysql_query($query1); // Initial page num setup if ($page == 0){$page = 1;} $prev = $page - 1; $next = $page + 1; $lastpage = ceil($total_pages/$limit); $LastPagem1 = $lastpage - 1; $paginate = ''; if($lastpage > 1) { $paginate .= "<div class='paginate'>"; // Previous if ($page > 1){ $paginate.= "<a href='$targetpage?page=$prev'>previous</a>"; }else{ $paginate.= ""; } // Pages if ($lastpage < 7 + ($stages * 2)) // Not enough pages to breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } } elseif($lastpage > 5 + ($stages * 2)) // Enough pages to hide a few? { // Beginning only hide later pages if($page < 1 + ($stages * 2)) { for ($counter = 1; $counter < 4 + ($stages * 2); $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } $paginate.= "..."; $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>"; $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>"; } // Middle hide some front and some back elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2)) { $paginate.= "<a href='$targetpage?page=1'>1</a>"; $paginate.= "<a href='$targetpage?page=2'>2</a>"; $paginate.= "..."; for ($counter = $page - $stages; $counter <= $page + $stages; $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } $paginate.= "..."; $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>"; $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>"; } // End only hide early pages else { $paginate.= "<a href='$targetpage?page=1'>1</a>"; $paginate.= "<a href='$targetpage?page=2'>2</a>"; $paginate.= "..."; for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++) { if ($counter == $page){ $paginate.= "<span class='current'>$counter</span>"; }else{ $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";} } } } // Next if ($page < $counter - 1){ $paginate.= "<a href='$targetpage?page=$next'>next</a>"; }else{ $paginate.= "<span class='disabled'>next</span>"; } $paginate.= "</div>"; } //echo $total_pages.' Results'; // pagination echo $paginate; ?> <div class="newsBorder"> <table cellspacing="0" border="0" id="newsList" class="width100"> <tbody> <tr class="row_a"> <td width="30%" class="1 first" id="titleCat"> <b>Category</b> </td> <td width="50%" class="item" id="titleTitle"> <b>News Item</b> </td> <td width="20%" align="right" class="date"> <b>Date</b> </td> </tr> </tbody> </table> <?php while($row = mysql_fetch_array($result)) { ?> <tr class="pad"> <td valign="top"> <a href="list.ws?cat=3&page=1" class="catLink"> <img alt="" src="http://www.runescape.com/img/news/mini_customer_support.gif"> <span>Website</span> </a> </td> <td valign='middle'><a href="news.php?newsid=<?php echo $row['newsid'] ?>" class="titleLink"><?php echo $row['title']; ?> </a></td> <td valign="middle" align="right" class="date"><?php echo $row['dtime']; ?></td></tr><br> <?php } ?> </div> Here is how it looks right now: Here is how I want it to look like. Its basically everything inside the while is not formatting. I have all the CSS I need so that isnt the problem. Thanks for the help ahead of time. Hi all, Anyone give me a few hints how I can add a next and previous button to my pagination links? I currently have this: <?php } if($total_records > 5) ?> <div id="pg"> <?php { for ($i = 1; $i <= $total_pages; $i++) { echo "<a title='page $i' class='current' href='?catid=" . $catid ."&"; if($subid > 0) { echo "subid="; echo $subid . "&"; } echo "p= $i'>$i</a>"; } } ?> </div> Which displays them nicely, but I would like a next and previous button. Cheers I messed around with a simple pagination script I found online. I'm still diving in and breaking it down to try and understand it better but I also was planning to have a "next" and "previous" link instead of just echoing out page numbers. I know I'll have to come up with some $pg+1 or $pg-1 function but how do I find out what $pg is currently on? function showSubmissions(){ $max = 9; // number of news entries per page $pg = $_GET['pg']; if(empty($pg)) { $pg = 1; } $limits = ($pg - 1) * $max; //view all the news articles in rows $q = mysql_query("SELECT * FROM submissions WHERE approved='YES' ORDER BY postdate DESC LIMIT " . $limits . ", $max") or die(mysql_error()); //the total rows in the table $totalres = mysql_result(mysql_query("SELECT COUNT(id) AS tot FROM submissions"), 0); //the total number of pages (calculated result), math stuff... $totalpages = ceil($totalres / $max); // BEGIN PAGINATION print ' <div class="paginationList"> <ul class="pgList"> <li><img src="images/icon_prevresult.png" title="" alt="" /></li>'; for($i = 1; $i <= $totalpages; $i++) { //this is the pagination link print '<li><a href="submissions.php?pg=' . $i . '">' . $i . ' </a></li>'; } print ' <li><img src="images/icon_nextresult.png" title="" alt="" /></li> </ul> </div>'; // END PAGINATION // PRINT RESULTS while($row = mysql_fetch_array($q)) { $id = $row['id']; $name = stripslashes($row['name']); $email = $row['email']; print ' <div class="sub-thumb-wrapper"> <div class="sub-thumb-user"> <div class="ps-name"><p class="sub-label">NAME:</p><a href="mailto:' . $email . '">' . $name . '</a></div> </div> </div>' . "\n"; } // END PRINT RESULTS } I've got a page with pagination set up, but I can't figure out where I went wrong with the links at the bottom. When I do a search, it generates the proper number of links, but clicking on the links goes to a page with a whole row of 20 links at the bottom and no results on the page. (my search should show 3 pages with 2 records on each page) I've looked through the tutorial here and one in a book on pagination. Not seeing what's wrong. I'd narrow this down if I knew where it was causing the problem. pagination links are at the very bottom of the code. Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>search.html</title></head> <body> <center> <p>The results of your search:</p> <br> </center> require ('databaseconnect.php'); $select = mysql_select_db($db, $con); if(!$select){ die(mysql_error()); } $display = 2; if (isset($_GET['np'])) { $num_pages = $_GET['np']; } else { $data = "SELECT COUNT(*) FROM descriptors LEFT JOIN plantae ON (descriptors.plant_id = plantae.plant_name) WHERE `leaf_shape` LIKE '%$select1%' AND `leaf_venation` LIKE '%$select3%' AND `leaf_margin` LIKE '%$select4%'"; $result = mysql_query ($data); if (!$result) { die("Oops, my query failed. The query is: <br>$data<br>The error is:<br>".mysql_error()); } $row = mysql_fetch_array($result, MYSQL_NUM); // row 41 $num_records = $row[0]; if ($num_records > $display) { $num_pages = ceil ($num_records/$display); } else { $num_pages = 1; } } if (isset($_GET['s'])) { $start = $_GET['s']; } else { $start = 0; } if(isset($_POST[submitted])) { // Now collect all info into $item variable $shape = $_POST['select1']; $color = $_POST['select2']; $vein = $_POST['select3']; $margin = $_POST['select4']; // This will take all info from database where row tutorial is $item and collects it into $data variable row 55 $data = mysql_query("SELECT `descriptors`.* ,`plantae`.* FROM `descriptors` LEFT JOIN `plantae` ON (`descriptors`.`plant_id` = `plantae`.`plant_name`) WHERE `leaf_shape` LIKE '%$select1%' AND `leaf_venation` LIKE '%$select3%' AND `leaf_margin` LIKE '%$select4%' ORDER BY `plantae`.`scientific_name` ASC LIMIT $start, $display"); //chs added this in... row 72 echo '<table align="center" cellspacing="0" cellpading-"5"> <tr> <td align="left"><b></b></td> <td align="left"><b></b></td> <td align="left"><b>Leaf margin</b></td> <td align="left"><b>Leaf venation</b></td> </tr> '; // This creates a loop which will repeat itself until there are no more rows to select from the database. We getting the field names and storing them in the $row variable. This makes it easier to echo each field. while($row = mysql_fetch_array($data)){ echo '<tr> <td align="left"> <a href="link.php">View plant</a> </td> <td align="left"> <a href="link.php">unknown link</a> </td> <td align="left">' . $row['scientific_name'] . '</td> <td align="left">' . $row['common_name'] . '</td> <td align="left">' . $row['leaf_shape'] . '</td> </tr>'; } echo '</table>'; } if ($num_pages > 1) { echo '<br /><p>'; $current_page = ($start/$display) + 1; // row 100 if ($current_page != 1) { echo '<a href="leafsearch2a.php?s=' . ($start - $display) . '&np=;' . $num_pages . '">Previous</a> '; } for ($i = 1; $i <= $num_pages; $i++) { if($i != $current_page) { echo '<a href="leafsearch2a.php?s=' . (($display * ($i - 1))) . '$np=' . $num_pages . '">' . $i . '</a>'; } else { echo $i . ' '; } } if ($current_page != $num_pages) { echo '<a href="leafsearch2a.php?s=' . ($start + $display) . '$np=' . " " . $num_pages . '"> Next</a>'; } } ?> </body></html> I am pretty new to PHP and am trying to create a simple (so I assumed) page to takes data from one html page(works fine) and updates a MYSQL Database. I am getting no error message, but the connect string down to the end of the body section is showing up as plain text in my browser window. I do not know how to correct this. I have tried using two different types of connect strings and have verified my names from the HTML page are the same as listed within the php page. Suggestions on what I need to look for to correct would be great. I have looked online, but so far all I am getting is how to connect, or how to create a comment, so I thought I would try here. Thank you for any assistance I may get!! - Amy - Code: [Select] <body><font color="006600"> <div style="background-color:#f9f9dd;"> <fieldset> <h1>Asset Entry Results</h1> <?php // create short variable names $tag=$_POST['tag']; $serial=$_POST['serial']; $category=$_POST['category']; $status=$_POST['status']; $branch=$_POST['branch']; $comments=$_POST['comments']; if (!$tag || !$serial || !$category || !$status || !$branch) { echo "You have not entered all the required details.<br />" ."Please go back and try again."; exit; } if (!get_magic_quotes_gpc()) { $tag = addslashes($tag); $serial = addslashes($serial); $category = addslashes($category); $status = addslashes($status); $branch = addslashes($branch); $comments = addslashes($comments); } //@ $db = new mysqli('localhost', 'id', 'pw', 'inventory'); $db = DBI->connect("dbi:mysql:inventory:localhost","id","pw") or die("couldnt connect to database"); $query = "insert into assets values ('".$serial."', '".$tag."', '".$branch."', '".$status."', '".$category."', '".$comments."')"; $result = $db->query($query); if ($result) { echo $db->affected_rows." asset inserted into Inventory."; } else { echo "An error has occurred. The item was not added."; } $db->close(); ?> </fieldset> </div> </body> 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 have pagination system with FIRST LETTER separated and everything is OK.
$page = (int)(!isset($_GET["page"]) ? 1 : $_GET["page"]); if ($page <= 0) $page = 1; $per_page = 5; $startpoint = ($page * $per_page) - $per_page; $statement = "restaurants ORDER BY `name`"; // make foo the current db '" . addslashes($_GET['id']) . "' $result = mysqli_query($mysqli,"SELECT name FROM restaurants WHERE cuisine_ID_obsolete=5 ORDER BY name LIMIT {$startpoint} , {$per_page}"); if (mysqli_num_rows($result) == 0) { echo "No records are found."; } else { $lastFoundLetter = ''; // displaying records. while ($row = mysqli_fetch_array($result)) { $firstLetter = substr($row['name'], 0, 1); if ($firstLetter != $lastFoundLetter) { if ($lastFoundLetter != '') { echo "</br>"; } echo strtoupper($firstLetter) . "<br/>"; $lastFoundLetter = $firstLetter; } echo $row['name'] . "<br/>"; } } echo pagination($statement,$per_page,$page); ?>Function for pagination: <?php function pagination($query,$per_page=10,$page=1,$url='?'){ global $mysqli; $query = "SELECT COUNT(*) as `num` FROM restaurants WHERE cuisine_id_OBSOLETE = '12'"; $row = mysqli_fetch_array(mysqli_query($mysqli,$query)); $total = $row['num']; $adjacents = "1"; $prevlabel = "<img src='files/prev.png'>"; $nextlabel = "<img src='files/next.png'>"; $page = ($page == 0 ? 1 : $page); $start = ($page - 1) * $per_page; $prev = $page - 1; $next = $page + 1; $lastpage = ceil($total/$per_page); $lpm1 = $lastpage - 1; // //last page minus 1 $pagination = ""; if($lastpage > 1){ $pagination .= "<ul class='pagination'>"; if ($page > 1) $pagination.= "<li><a href='{$url}page={$prev}'>{$prevlabel}</a></li>"; if ($lastpage < 7 + ($adjacents * 2)){ for ($counter = 1; $counter <= $lastpage; $counter++){ if ($counter == $page) $pagination.= "<li><a class='current'>{$counter}</a></li>"; else $pagination.= "<li><a href='{$url}page={$counter}'>{$counter}</a></li>"; } } elseif($lastpage > 1 + ($adjacents * 2)){ if($page < 1 + ($adjacents * 2)) { for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++){ if ($counter == $page) $pagination.= "<li><a class='current'>{$counter}</a></li>"; else $pagination.= "<li><a href='{$url}page={$counter}'>{$counter}</a></li>"; } $pagination.= "<li class='dot'>...</li>"; $pagination.= "<li><a href='{$url}page={$lpm1}'>{$lpm1}</a></li>"; $pagination.= "<li><a href='{$url}page={$lastpage}'>{$lastpage}</a></li>"; } elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination.= "<li><a href='{$url}page=1'>1</a></li>"; $pagination.= "<li><a href='{$url}page=2'>2</a></li>"; $pagination.= "<li class='dot'>...</li>"; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) $pagination.= "<li><a class='current'>{$counter}</a></li>"; else $pagination.= "<li><a href='{$url}page={$counter}'>{$counter}</a></li>"; } $pagination.= "<li class='dot'>..</li>"; $pagination.= "<li><a href='{$url}page={$lpm1}'>{$lpm1}</a></li>"; $pagination.= "<li><a href='{$url}page={$lastpage}'>{$lastpage}</a></li>"; } else { $pagination.= "<li><a href='{$url}page=1'>1</a></li>"; $pagination.= "<li><a href='{$url}page=2'>2</a></li>"; $pagination.= "<li class='dot'>..</li>"; for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "<li><a class='current'>{$counter}</a></li>"; else $pagination.= "<li><a href='{$url}page={$counter}'>{$counter}</a></li>"; } } } if ($page < $counter - 1) $pagination.= "<li><a href='{$url}page={$next}'>{$nextlabel}</a></li>"; $pagination.= "</ul>"; } return $pagination; } ?>Problem is, since I have FIRST LETTER separated, with $per_page. How to exclude FIRST LETTER and "<br/>" from $per_page variable? So, here goes...
On my website, http://jamaica2go.com, I have destinations laid out in thumbnails on the main destination page. The page is using three columns. The page works fine as it is, however, I know that as I add more locations scrolling will become an issue. The author did a great job on this theme and he also gave an option to select maximum number of items to be shown but no paging occurs once you hit that max (weird, right?).
I have tried, I really have. Reading up on the WP codex, hunting down scripts and tutorials, all with a view to adding this simple feature. I know if someone figures this out it's going to be easy as cheese but the drawback for me is that I'm not a PHP programmer, just pretty decent at editing and changing the code.
Anyway, I'm posting the entire page code below (realised at end that I can attach, so did that instead). The important stuff happens in the "uxbarn_custom_port_load_portfolio_shortcode" function and onward. I noticed that although he starts a while loop to write the thumbnails to the page, he doesn't seem to end it. He also has a pagination template for the blog page which I'll add below but I couldn't make heads or tails of it. Hope someone can assist.
PORTFOLIO PAGE
------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------
The template below is used for blog and search and is called with:
<?php get_template_part( 'template-pagination' ); ?>
PAGINATION TEMPLATE
------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------
<?php $big = 999999999; global $wp_query; $total_pages = $wp_query->max_num_pages; if( is_search() ) { // Only for search page, there are 10 posts per page // And always round up the result $total_pages = ceil( $wp_query->found_posts / 10 ); } if ( $total_pages > 1 ) { echo '<div class="row no-margin-bottom"> <div id="blog-pagination" class="uxb-col large-12 columns pagination-centered"> '; $current_page = max( 1, get_query_var( 'paged' ) ); echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '&page=%#%', 'current' => $current_page, 'total' => $total_pages, 'prev_text' => '<i class="icon ion-ios7-arrow-left"></i>', 'next_text' => '<i class="icon ion-ios7-arrow-right"></i>', 'type' => 'list' )); echo '</div> </div>'; } ?> ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------------------ Attached Files custom-uxbarn-portfolio.php 33.24KB 2 downloads template-pagination.php 1022bytes 0 downloads I've looked at loads of other scripts that highlight the page but none of them work on mine . Here's part of my code: $i =1; for ($x=0;$x<$foundnum;$x=$x+$e) { echo " <a href='search.php?search=$search&s=$x'>$i</a> "; $i++; Hello- I have a social network that has a blogs and questions section. There are community pages for each one ( blogs/questions ) On each of those pages. the first ten blogs/questions are displayed. To the right of those are a list of clickable categories that sort the pages according to their category. I have pagination implemented after each ten. I am doing a mod_rewrite for pretty urls on my dev and have everything working correctly. The problem is, after hitting next the first time 'page=' is blank and just reloads the first (defaulted page) but after a second click it becomes 'page=10' as it should and then the third click 'page=20" as it should. So basically I am trying to get it to go to 'page=10" after one click, not two. Here is the code for the pagination: Code: [Select] <div id="all_page_turn"> <ul> <?php if($totalBlogs > 10 && $_GET['page'] >= 10) { ?> <li class="PreviousPageBlog round_10px"> <a href="/blogs/?cat=<?php if(isset($_GET['cat'])) { echo $_GET['cat'];} ?>&sort=<?php if(isset($_GET['sort'])) { echo $_GET['sort'];} ?>&page=<?php if(isset($_GET['page'])) { echo ($_GET['page'] - 10);} ?>">Previous Page</a> </li> <?php } ?> <?php if($totalBlogs > 10 && $_GET['page'] < ($totalBlogs-10)) { ?> <li class="NextPageBlog round_10px"> <a href="/blogs/?cat=<?php if(isset($_GET['cat'])) { echo $_GET['cat'];} ?>&sort=<?php if(isset($_GET['sort'])) { echo $_GET['sort'];} ?>&page=<?php if(isset($_GET['page'])) { echo ($_GET['page'] + 10);} ?>">Next Page</a> </li> <?php } ?> </ul> </div> </div>and here is the defaulted category link: Code: [Select] <div id="RightBlogs"> <div id="search_blogs_future" class="round_10px"> <form name="searchBlogs" action="/blogs" method="get"> <input type="text" name="BlogSearch" class="text" value="<?php if(empty($_GET['BlogSearch'])) { echo "Search Blogs"; }else{ echo $_GET['BlogSearch'];} ?>" onclick="clearify(this);" /> <input type="submit" name="subBlogSearch" value="Search" /> </form> </div> <div class='<?php if(empty($_GET['cat']) || $_GET['cat'] == "All") { echo "all_blog_cats_Highlighted"; }else{ echo "all_blog_cats_unHighlighted"; } ?> round_10px'> <a href='/blogs/?cat=All'> All </a> </div>Here is a screen shot of the page, as I'm on my dev so I can't provide a link. you can't see the "next" button, but it's there on the bottom, and then the categories are on the right. [attachment deleted by admin] Hi, Can any one help me wit the pagination in android mobile App Pls find the attached file for full code As per the below coe it displays only 40 posts but i have around 500 posts. I can increse function add_query_vars($public_query_vars) { $public_query_vars[] = $this->namespace.'_p'; return $public_query_vars; } $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'category__in' => $categories, ); if ($wp->query_vars[$this->namespace.'_p'] == 1){ $args['posts_per_page'] = 10; $args['offset'] = 0; }else{ $args['posts_per_page'] = 40; $args['offset'] = 10; } $posts = get_posts($args); I have tried but i am getting only 210 posts.only if i increse the post_per_page more than 70 in mobile android app it shows loding $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'category__in' => $categories ); if ($wp->query_vars[$this->namespace.'_p'] == 1){ $args['posts_per_page'] = 70; $args['offset'] = 0; } if ($wp->query_vars[$this->namespace.'_p'] == 2){ $args['posts_per_page'] = 140; $args['offset'] = 70; } if ($wp->query_vars[$this->namespace.'_p'] == 3){ $args['posts_per_page'] = 210; $args['offset'] = 140; } $posts = get_posts($args); Attached Files wp-app-maker.php 49.23KB 1 downloads Hi, somehow iv managed to add pagination to my project, but im struggling with one thing - i dont know how to move the pagination "symbols" (idk how they r called).. here's a pic that will explain what im talking about: and heres the code that im using: //The directory to your images folder, with trailing slash $dir = "uploads/thumbs/watermarkedthumbs/"; //Set the extensions you want to load, seperate by a comma. $extensions = "jpeg,jpg"; //Set the number of images you want to display per page $imagesPerPage = 4; //Set the $page variable if(!isset($_GET['page'])){ $page = 1; }else{ $page = $_GET['page']; } //Load all images into an array $images = glob($dir."*.{".$extensions."}", GLOB_BRACE); //Count the number of images $totalImages = count($images); //Get the total pages $totalPages = ceil($totalImages / $imagesPerPage); //Make sure the page you are on is not greater then the total pages available. if($page > $totalPages){ //Set the currnet page to the total pages. $page = $totalPages; } //Now find where to start the loading from $from = ($page * $imagesPerPage) - $imagesPerPage; //Now start looping for($i = $from; $i < ($from + $imagesPerPage); $i++){ //We need to make sure that its within the range of totalImages. if($i < $totalImages){ //Now we can display the image! echo "<img style='border:thin solid #FFF;margin-top:10px;margin-left:10px;margin-right:10px' src='{$images[$i]}'alt='{$images[$i]}' />"; } } //Now to display the page numbers! for($p = 1; $p <= $totalPages; $p++){ if($p == $page){ $tmp_pages[] = "<strong>{$p}</strong>"; }else{ $tmp_pages[] = "<a href='?page={$p}'>{$p}</a>"; } } //Now display pages, seperated by a hyphon. echo "<br />" . implode(" - ", $tmp_pages); ?> how do i move the 'page numbers' ? thanks in advance Hello, I adapted the pagination script from the tutorial (great instruction and detail) from this site and it works perfectly. However, I added a search engine to it and it works like it should. The problem comes in with the following SQL query: Code: [Select] $sql = "SELECT COUNT(*) FROM qa"; If i modify it to fit my query, the number at the bottom of the page disappears and the > >> links go to blank pages. Also all queried rows show on one page and doesn't stop at ten. How do i modify my pagination script with a search engine so people can query their results without 'breaking' the pagination script?? Hi,
I am looking for a tutorial or code sample I can use to learn MySQLi pagination with an option to select items per page, like the attached screenshort.
Any help is grately appreciated.
Regards.
joseph
Attached Files
table-pagination.jpg 32.87KB
0 downloads Hi all, I created a page template at http://www.durgeshsound.com/gallery/ Here my pagination buttons are not working. this issue arises when permalink format is http://www.example.com/sample-post/ But when I set permalink format to default (www.example.com/?p=123) then it starts to work and creates a working pagination link like this http://www.durgeshso...e_id=81&paged=2. I want this format http://www.example.com/sample-post/ in the links. Please help. Hey all, Been coding another script for my website which allows me to update a users Rank, allthough, when I try and view the page its giving me a White Blank Page. I carn't accually see whats wrong in my Script... <?php session_start(); include ("../includes/config.php"); include ("../includes/function.php"); logincheck(); ini_set ('display_errors', 1); error_reporting (E_ALL); $username = $_SESSION['username']; // Owner Script - Change Users Rank $userlevel = mysql_query ("SELECT * FROM users WHERE username = '$username' LIMIT 1") or die ("Error Finding Right Users " . mysql_error()); $levelright = mysql_fetch_object($userlevel); // If userlevel isn't 5, move them on... if ($levelright->userlevel == "1" || $levelright->userlevel == "2" || $levelright->userlevel == "3" || $levelright->userlevel == "4"){ header ("Location: 404.php"); die(); } // Start Change Rank... if (strip_tags($_POST['changerank'])){ $name = $_POST['name']; $userchange = $_POST['userchange']; $real = mysql_query ("SELECT * FROM users WHERE username = '$userchange' LIMIT 1"); $number = mysql_num_rows($real); if ($number != "1"){ echo ("$userchange, is NOT registered! - Simple Words : No Such User!"); } if ($name == 1){ $reprand = rand(100, 50000); mysql_query ("UPDATE users SET rank = 'Learner Driver (1)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 1 if ($name == 2){ $reprand = rand(50000, 200000); mysql_query ("UPDATE users SET rank = 'Passed Driver (2)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 2 if ($name == 3){ $reprand = rand(200000, 500000); mysql_query ("UPDATE users SET rank = 'New Driver (3)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 3 if ($name == 4){ $reprand = rand(500000, 2500000); mysql_query ("UPDATE users SET rank = 'Speeding Driver (4)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 4 if ($name == 5){ $reprand = rand(2500000, 7000000); mysql_query ("UPDATE users SET rank = 'Skilled Driver (5)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 5 if ($name == 6){ $reprand = rand(7000000, 20000000); mysql_query ("UPDATE users SET rank = 'Maniac Driver (6)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 6 if ($name == 7){ $reprand = rand(20000000, 45000000); mysql_query ("UPDATE users SET rank = 'Wanted Racer (7)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 7 if ($name == 8){ $reprand = rand(45000000, 90000000); mysql_query ("UPDATE users SET rank = 'Pro Driver (8)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 8 if ($name == 9){ $reprand = rand(90000000, 115000000); mysql_query ("UPDATE users SET rank = 'Supreme Racer (9)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 9 if ($name == 10){ $reprand = rand(115000000, 150000000); mysql_query ("UPDATE users SET rank = 'Super Supreme Racer (10)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 10 if ($name == 11){ $reprand = rand(150000000, 210000000); mysql_query ("UPDATE users SET rank = 'Show Off Driver (11)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 11 if ($name == 12){ $reprand = rand(210000000, 280000000); mysql_query ("UPDATE users SET rank = 'Extreme Show Off Driver (12)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 12 if ($name == 13){ $reprand = rand(280000000, 350000000); mysql_query ("UPDATE users SET rank = 'Trained Driver (13)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 13 if ($name == 14){ $reprand = rand(350000000, 430000000); mysql_query ("UPDATE users SET rank = 'Super Trained Driver (14)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 13 if ($name == 15){ $reprand = rand(430000000, 520000000); mysql_query ("UPDATE users SET rank = 'Legendry Racer (15)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 15 if ($name == 16){ $reprand = rand(520000000, 600000000); mysql_query ("UPDATE users SET rank = 'Most Legendry Racer (16)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 16 if ($name == 17){ $reprand = rand(600000000, 1000000000); mysql_query ("UPDATE users SET rank = 'Official SD Legend (17)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 17 if ($name == 18){ $reprand = rand(1000000000, 1000000010); mysql_query ("UPDATE users SET rank = 'Hidden Rank! (18)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 18 echo ("Successfully updated $userchange Rank!"); mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` ) VALUES ( '', '$userchange', 'System', 'Your Rank has now been changed!', '$date', '0', '0', '0')") or die ("Error updating there inbox!" . mysql_error()); } // Rank Change if (strip_tags($_POST['selectname'])){ $writenname = $_POST['nameinput']; $rankinput = $_POST['rankinput']; $repinput = $_POST['repinput']; $findme = mysql_query ("SELECT * FROM users WHERE username = '$writenname' LIMIT 1") or die ("Error Searching Names " . mysql_error()); $found = mysql_num_rows($findme); if ($found != "1"){ echo ("$writenname, isn't Registered! - Simple Terms : No Such User"); }else{ mysql_query ("UPDATE users SET rank = '$rankinput' AND rep = '$repinput' WHERE username= '$writenname'") or die ("Error Updating Rank + Rep " . mysql_error()); echo ("$writenname Rank has now been changed!"); mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` ) VALUES ( '', '$writenname', 'System', 'Your Rank has now been changed!', '$date', '0', '0', '0')") or die ("Error updating there inbox!" . mysql_error()); } // Found? } // Post selectname ?> <html> <head> <title>Change Users Rank</title> </head> <body class='body'> <form action='' method='POST' name='Change Rank'> <table width='40%' border='1' cellpadding='0' cellspacing='0' class='table' align='center'> <tr> <td class='header' align='center' colspan='2'>Change Users Rank?</td> </tr> <tr> <td class='omg' align='center'>This will change the users Current Rank!</td> </tr> <tr> <td align='right'>Username:</td><td><input type='text' name='userchange' class='input'></td> </tr> <tr> <td><select name='name' size='1' class='dropbox'> <option value="1">Learner Driver (1)</option> <option value="2">Passed Driver (2)</option> <option value="3">New Driver (3)</option> <option value="4">Speeding Driver (4)</option> <option value="5">Skilled Driver (5)</option> <option value="6">Maniac Driver (6)</option> <option value="7">Wanted Racer (7)</option> <option value="8">Pro Driver (8)</option> <option value="9">Supreme Racer (9)</option> <option value="10">Super Supreme Racer (10)</option> <option value="11">Show Off Driver (11)</option> <option value="12">Extreme Show Off Driver (12)</option> <option value="13">Trained Driver (13)</option> <option value="14">Super Trained Driver (14)</option> <option value="15">Legendry Racer (15)</option> <option value="16">Most Legendry Racer (16)</option> <option value="17">Official SD Legend (17)</option> <option value="18">Hidden Rank! (18)</option></td> </tr> <tr> <td class='omg' align='center' colspan='2'><input type='submit' name='changerank' class='button'></td> </tr> </table> <br /> <table width='40%' border='1' cellpadding='0' cellspacing='0' class='table' align='center'> <tr> <td class='header' align='center' colspan='2'>Change Rank?</td> </tr> <tr> <td class='omg' align='center'>This will change the <strong>posted</strong> users Rank and Rep!</td> </tr> <tr> <td align='right'>Username:</td><td><input type='text' name='nameinput' class='input'></td> </tr> <tr> <td align='right'>Rank:</td><td><input type='text' name='rankinput' class='input'></td> </tr> <tr> <td align='right'>Rep:</td><td><input type='text' name='repinput' class='input'></td> </tr> <tr> <td align='center' colspan='2'><input type='submit' name='selectname' class='button'></td> </tr> </table> </form> </body> </html> Anyone able to see where I'm going wrong? Thanks |