PHP Increment/Decrement

Discuss how to write good code, break bad code, your current pet projects, or the best way to approach novel problems

Re: PHP Increment/Decrement

Post by flyinbryan125 on Mon Dec 24, 2012 2:01 am
([msg=71819]see Re: PHP Increment/Decrement[/msg])

how about this?
Code: Select all
<?php
//get the current page
if(isset($_GET['page']));
{
         $page = sanitizer($_GET['page']);
}
//if page isnt set.
else
{
     $page = 0; //or 1, whatever u want the first page to be.
}
if(isset($_GET['job'])
{
     $job = sanitizer($_GET['job']);
}
if (isset($_POST['next']))
{
$page++;
   header("Location:http://mysite.com/preview/preview.php?job=california&page=$page");
}
if (isset($_POST['previous']))
{
    $page--;
   header("Location:http://mysite.com/preview/preview.php?job=california&page=$page");
}

if ($page <= 1)
{
      echo "<script src='http://myblog.tumblr.com/tagged/$job/js" type='text/javascript'></script>";
   $form = "<form method="POST">
                <input type="submit" name="next" value="next">
             </form>";
}
else
{
       echo "<script src='http://myblog.tumblr.com/tagged/$job/page/$page/js" type='text/javascript'></script>";
   $form = "<form method="POST">
                 <input type="submit" name="previous" value="previous">
                 <input type="submit" name="next" value="next">
                  </form>";
}
echo $form;
?>
flyinbryan125
New User
New User
 
Posts: 4
Joined: Wed Dec 19, 2012 7:57 pm
Blog: View Blog (0)


Previous

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests