-2

I'm putting together a site to show my schoolschedule. Because the url to my schedule changes every week. For instance:

www.example.com/"weeknumber"

If I want to check my schedule, I have to change the url every week. Therefore I want to build a site so I can check my schedule on one url every week.

Any help is appreciated.

Tom
  • 1

2 Answers2

0

Unless you have one page per week schedule (which you shouldn't), you can convert your weeknumber to a query parameter so that your URL looks like www.example.com/index.html?weeknumber=5.

Then you can retrieve this value in your PHP codes using $_GET. So your PHP codes will look something like:

<?php
    $weeknumber = $_GET['weeknumber'];
    // codes that use $weeknumber to retrieve week schedule
?>
ivan.sim
  • 8,972
  • 8
  • 47
  • 63
0

You could write a little php script that automatically redirect you to your schedule URL adding the actual weeknumber.

To get the actual weeknumber use date("W"). Then generate the url new url. After that redirect to that URL using header. header("Location:".$url)

You could also change the week variable to show the next or last week.

Here you can read more: How to make a redirect in PHP?

Community
  • 1
  • 1
Marcus Rommel
  • 1,266
  • 1
  • 12
  • 17