Jump to content

Passing variable in URL with Previous/Next hyperlink


seblondres

Recommended Posts

Hi Everyone,

 

I’m currently using the indeed API to retrieve jobs. Users can either use the search box or click on some hyperlinks e.g. Java Developer. If they click on a hyperlink, I’m using &GET to pick up the keywords from the URL to query Indeed e.g. www.sitename.com/index.php?job=java in this case the page will display all the jobs that contain the keyword java.

Now the indeed API is limited to 25 jobs per request, but they have a parameter call “start” that can be added at the end of the URL above to call more jobs e.g. www.sitename.com/index.php?job=java&start=10 will call the next 10 jobs.

 

So I’m trying to figure out, how I could add a next / previous link at the bottom of the pages that will add that piece of code &start=10, &start=20 etc. in the URL so users can call more jobs, any idea?

 

Thanks for your help,

Seb

Link to comment
Share on other sites

Many thanks for taking the time to answer my question. I had a look at some pagination scripts and built the below and...it works fine!

 

<?php$search = $_GET["job"];$start = $_GET["start"];$query = http_build_query(array("job" => $search, "start" => $start+10));echo "<a href='/enterprises-a.php?$query'>Next</a>";?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...