Jump to content
Sign in to follow this  
seblondres

Passing variable in URL with Previous/Next hyperlink

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

Share this post


Link to post
Share on other sites

What code are you using so far? If you have a way to get the total number of results then you can use pagination, there are many examples of pagination online.

Share this post


Link to post
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>";?>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...