dezkit Posted June 12, 2008 Share Posted June 12, 2008 Im trying to do so that when somebody is on a page, it shows the first 6 mysql data, and then underneath it says view all, and when you press on view all, it shows the rest of the data.... thanks Quote Link to comment Share on other sites More sharing options...
ag3nt42 Posted June 12, 2008 Share Posted June 12, 2008 for this situation I would do something like this if(!(isset($_POST['showall']))) { $firstsix='no'; } else { $firstsix='yes'; } if($firstsix=='yes') { RUN QUERY TO GENERATE FIRST 6 } if($firstsix=='no') { RUN QUERY TO GENERATE ALL } <form action='yourpage.php' method='post'> <input type='hidden' value='showall' <input type='submit' value='Show All' /> I would submit this to the same page your form is on. Something like that. Quote Link to comment Share on other sites More sharing options...
MatthewJ Posted June 12, 2008 Share Posted June 12, 2008 You could also just use a link and use $_GET to set the variable if(!(isset($_GET['showall']))) { $firstsix='no'; } else { $firstsix='yes'; } if($firstsix=='yes') { RUN QUERY TO GENERATE FIRST 6 } if($firstsix=='no') { RUN QUERY TO GENERATE ALL } <a href="page.php?showall=true">Show all</a> Same thing really, I just don't like form buttons Quote Link to comment Share on other sites More sharing options...
ag3nt42 Posted June 12, 2008 Share Posted June 12, 2008 I hate having to write out all the code associated with forms but I also hate the mess you get with $_GET me.com?asfd=asdfasdfasdf&iou=asdfasdfasdfasdfsfd&poipoi=asdfasdfasdfasdfasdfasdf ya kno Quote Link to comment Share on other sites More sharing options...
dezkit Posted June 12, 2008 Author Share Posted June 12, 2008 heh, thanks guys, but i want this in JAVASCRIPT!! \ :D/ Quote Link to comment Share on other sites More sharing options...
MatthewJ Posted June 12, 2008 Share Posted June 12, 2008 heh... well, maybe a javascript forum would be better than a php forum Quote Link to comment Share on other sites More sharing options...
ag3nt42 Posted June 13, 2008 Share Posted June 13, 2008 doing it in javascript would be nice only if you do not want to refresh the page.. but what will you do when a user has javascript turned off? You should never rely on javascript to run your sites. think of js as more of a bonus feature Quote Link to comment 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.