Hi there everyone,
I am looking for a code where a visitor is able to type in a file or page ID number in a box, and when they hit go the code will automatically take tem to "mysite.com/The code they typed in"
Any help?
Hi there everyone,
I am looking for a code where a visitor is able to type in a file or page ID number in a box, and when they hit go the code will automatically take tem to "mysite.com/The code they typed in"
Any help?
Is the formatting of the address always the same like yoursite.com/photo?ID=1123
Last edited by Snookerman; 04-22-2009 at 05:39 AM. Reason: removed link
Yes, its always the same URL followed by a file ID. the URL does not changed!
Any help?
Is the page list static, ie always the same pages.
If so you could present the options as part of a SELECT input type, saves your visitors from having to type anything
It would then be possible to open the selected page using window.open in Javacript.
Well this is from my business employees, and there are over 5,000 documents. we reffer to those docs by ID number, so it would be easier if we had a search box that if they type in the Doc ID it would take them straight to it.
Any help?
Once you've made the necessary search box / form etc use this code:
Hope this works for youPHP Code:<?php
// Let's say the only thing passed to the PHP code is the ID
$id = mysql_real_escape_string($_POST['id']); // Make safe for query
$query = mysql_query("SELECT * FROM photoids WHERE `id` = $id");
if(!$query)
die('Unable to execute query: ' . mysql_error());
if(!mysql_num_rows($query))
die('The ID you were looking for does not exist');
// If it makes it this far then the ID does exist so we redirect to the appropriate page
header("Location: mysite.com/photo?id=$id");
?>
Edit: I imagined that you'd have some sort of database, because there's not much point in having a search function if there're no records.
Bookmarks