Jump to content

Redirect to static web page from user input box


Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.