PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
if(isset($_post['submit']))
{
$limits = 5;
$page = $_GET['page'];
if(empty($limit)){
$postion=0;
$page=1;
}
//below here is my code for display data from database into table
}
I am coding display my data from database into table with pagination.. i put a menu list so that user can choose which data he/she wants to be sorted.. for example blackberry, iphone, samsung. after they choose the menu list they click the button submit and table will show data of certain keyword... (blackberry, iphone, etc). the first page no problem.. but as my coding to go to the second page.. they need to click '2' (the second page) which will be ?page=blabla .. I want to get this value, but my $_GET['page'] is inside the isset.. how to do it ? for now if i click the second page the table will not show the data...
It doesn't show the data because it is all within the isset($_POST['submit']). When you click 2 and go to page.php?page=2 you are not submitting the form so the post['submit'] is not set.
I would suggest making your form with blackberry, etc... get instead of post and instead of isset($_POST['submit']) use $_GET['type']. Make sure you pass this type along though when you click on 2, or 3, etc...
Why are you using both GET and POST in the same code?
Either use one of the two methods GET/POST or use $_REQUEST instead which would not bother about the method being a get or post.
if(isset($_REQUEST['submit']))
{
$limits = 5;
$page = $_REQUEST['page'];
if(empty($limit)){
$postion=0;
$page=1;
}
//below here is my code for display data from database into table
}
shawngoldw wrote:It doesn't show the data because it is all within the isset($_POST['submit']). When you click 2 and go to page.php?page=2 you are not submitting the form so the post['submit'] is not set.
I would suggest making your form with blackberry, etc... get instead of post and instead of isset($_POST['submit']) use $_GET['type']. Make sure you pass this type along though when you click on 2, or 3, etc...
Shawn
yeah thats the problem.. i confuse how to get the post inside the isset.. i thought maybe there's syntax in php where i can set the isset already click.. Yeah i was about to make it different file but its only choose the category so i can combine them.. Thanks anyway for replying...
PradeepKr wrote:Why are you using both GET and POST in the same code?
Either use one of the two methods GET/POST or use $_REQUEST instead which would not bother about the method being a get or post.
if(isset($_REQUEST['submit']))
{
$limits = 5;
$page = $_REQUEST['page'];
if(empty($limit)){
$postion=0;
$page=1;
}
//below here is my code for display data from database into table
}
even if i use the request the if(isset($_REQUEST['submit'])) will not be executed.. Thanks anyway