Pointmewheretogo Posted July 15, 2012 Share Posted July 15, 2012 I am very new to web design. My current webmaster says that I need someone that programs databases to do what I want. I have NO idea where to go to find help on what I need to do. I hope someone here can help me in some way. Below is what I am looking to do. Let?s say I had a website with an index page and 100 static pages named (page1.html ? page100.html) I would like to have a box on the index page that a user could put in ?page5? then press enter and have it go to, or show a link to ?www.example.com/pages/page5.html? The index page would have NO links going to any of the static html pages 1-100. I do not want to use a Google Custom search box. I do not want a sitemap with a list of all the pages. I do not want the pages 1-100 to be indexed by search engines I use Dreamweaver. Do I need to get another program? I would and do appreciate any and all help I can get. I would be willing to hire someone to help me. Rob-Point me in the right direction please Quote Link to comment https://forums.phpfreaks.com/topic/265709-redirect-to-static-web-page-from-user-input-box/ Share on other sites More sharing options...
scootstah Posted July 15, 2012 Share Posted July 15, 2012 This is just a simple matter of capturing the input and then using it in a string (for link) or header call (for redirect). if (!empty($_POST)) { $page = $_POST['page']; // link echo '<a href="http://example.com/pages/' . $page . '.html">' . $page . '</a>'; // redirect header('location: http://example.com/pages/' . $page . '.html'); exit; } else { echo '<form method="post"> Page: <input type="text" name="page" /><button type="submit">Go</button> </form>'; } This will get you started. You may want to validate and/or sanitize the input. Quote Link to comment https://forums.phpfreaks.com/topic/265709-redirect-to-static-web-page-from-user-input-box/#findComment-1361693 Share on other sites More sharing options...
Pointmewheretogo Posted July 15, 2012 Author Share Posted July 15, 2012 Can you tell what am I doing wrong? http://dual07.com/ The index page is called index.php I have a folder called pages and I have 5 html pages inside, listed below. page1.html page2.html page3.html page4.html page5.html Rob Quote Link to comment https://forums.phpfreaks.com/topic/265709-redirect-to-static-web-page-from-user-input-box/#findComment-1361710 Share on other sites More sharing options...
PaulRyan Posted July 15, 2012 Share Posted July 15, 2012 You are not putting the PHP tags around the code... Put this at the start: <?PHP And put this at the end ?> Quote Link to comment https://forums.phpfreaks.com/topic/265709-redirect-to-static-web-page-from-user-input-box/#findComment-1361725 Share on other sites More sharing options...
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.