boxturt Posted September 3, 2004 Posted September 3, 2004 This has me stumped for many days. I'm pretty sure I've seen this but I don't remember where and I can't seem to get my head around it enough to figure it out. I would like to offer specific visitors the ability upon arriving at the site, enter a specific filename in a form field, click go and be taken straight there to that specific file. eg: go to h**p://****/some_folder/specificfile.html but all the visitor would type in is 'specificfile' I probably haven't posed this query very well and I apologize. Any hints would be greatly appreciated. Thank you Quote
TCH-Rob Posted September 3, 2004 Posted September 3, 2004 Something like; ><form method=post> Keyword: <br> <input type=text name=keyword> <input type=hidden name=sub value=1> <input type=submit value=Go!> <?php if($sub==1) { if($keyword=="keyword1") { echo("<script>window.location='url_for_keyword1';</script>"); } else if($keyword=="keyword2") { echo("<script>window.location='url_for_keyword2';</script>"); } else if($keyword=="keyword3") { echo("<script>window.location='url_for_keyword3';</script>"); } else { echo("That is not a valid keyword."); } } ?> Might work. Still looking, I found this at the sitepoint forums. Quote
boxturt Posted September 3, 2004 Author Posted September 3, 2004 Thanks Rob, I appreciate it. Pretty neat, works well but might get weird for content that's always getting added/changed/removed. I almost think I need some sort of modified site search that delivers the page on demand. I dunno. Clueless As Usual In Naugahyde....... Quote
boxturt Posted September 3, 2004 Author Posted September 3, 2004 Looks scary Lisa - but I'll check it out, thank you. Quote
DarqFlare Posted September 3, 2004 Posted September 3, 2004 Here's what I would use... It would need to be modified to work for extensions other than HTML: ><form method=post> Keyword: <br> <input type=text name=filename> <input type=hidden name=sub value=1> <input type=submit value=Go!> <?php if($sub==1) { if(file_exists("/home/yourcpaneluser/public_html/somefolder/" . $filename . ".html")) { header("Location: /somefolder/" . $filename . ".html"); } else { echo "The file, it does not exist! Run around and scream!"; } } ?> Quote
boxturt Posted September 3, 2004 Author Posted September 3, 2004 echo "The file, it does not exist! Run around and scream!"; Yes, well try that too. Thanks for the code, I haven't had time to mess with these yet but I will Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.