
Last I heard, IMDb has over 10 million personalities listed in its database, ranging from actors to cinematographers, writers to visual effects experts. On any given day, therefore, there should be thousands of matches, right? Fortunately the Internet Movie Database offers up results using a variety of sort criteria including the popularity of the person matched. After all, if you share a birthday with someone like Oprah or Tom Cruise, you don’t want to have their name way, way down the list, right?
Your query is an example of reverse engineering in the Web world. We’re going to do a search, then analyze the resultant URL and break down the elements to create our own form that can duplicate the query format. Ready?
Now, generally speaking, IMDb would undoubtedly prefer that you visit their site to search, so let’s start out with just that, going to the IMDb Birth Month Day page for August 13th.
Here’s the result:
Apparently both Sebastian Stan and Alfred Hitchcock were born on August 13. Cool.
But for our purposes, the URL that produces this page is much more important. Here it is:
The general form here is webapp?arguments where the arguments are all name=value, separated by an “&” symbol. In other words, this breaks down to:
app = https://www.imdb.com/search/name/ arg1 = birth_monthday=08-13 arg2 = ref_=nv_cel_brn
I find that most of the arguments given to these sort of search systems can be safely removed and a tiny test reveals that the following URL produces the exact same page on IMDb:
https://www.imdb.com/search/name/?birth_monthday=08-13
Before we go any further, that means you can hand-code a URL for any date if you want to just have a link on your page like this: Celebrities born on February 29th. Just change the MM-DD in the URL to match!
But let’s get back to that form, shall we? The same URL is what our HTML form will need to duplicate. Easy, actually:
<form method="get" action="https://www.imdb.com/search/name/"> <input name="birth_monthday" type="text" /> <input type="submit"> </form>
Of course, adding some text will help people understand what’s going on, so here’s my final code:
<h2>What Celebrities Share Your Birthday?</h2> <form method="get" action="https://www.imdb.com/search/name/"> <span style="font-size:120%">Enter desired date in MM-DD format:</span> <input name="birth_monthday" type="text" /><br /> <span style="color:#444">(For example, August 4 would be entered as 08-04) </span><br /> <input type="submit"> </form>
The result? Here’s that form live and ready for you to test:
What Celebrities Share Your Birthday?
Pretty cool, eh? Now just copy and paste the above code block into the ‘raw’ or ‘text’ edit window and you should have no problem adding the exact same form to your own blog post or Web page. Easy!
Pro Tip: I’ve been writing about HTML and web page development since the very beginning of the Web, including a bunch of books on the way. Please do check out my HTML and Web Design Help area here on the site while you’re visiting! Thanks.
The post Add A Celebrity Birthday Search Form To Your Web Site? originally appeared on Ask Dave Taylor.