Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass textbox value; stick .htm at the end; append to hardcoded URL 1

Status
Not open for further replies.

iteach2

Technical User
Joined
Sep 16, 2001
Messages
120
Location
US
Gurus,

I have a textbox with a button. How do I pass what ever name that is typed in that textbox append it to a hard coded URL and then stick .htm at the end so I can call a new page based on that input.

Like this:

1. The hardcoded URL looks like this (myfamily/albums/)

2. A user types Jeff into the text box and hits a button


3.Now the hardcoded URL should look like this(myfamily/albums/jeff.htm)

So finally what you have is
4. I don't want to use a drop down menu because of security I only want people to be able to search a name that only they know.

5. Maybe JavaScript is a better choice than using JavaScript I don't now. I was thinking some sort of redirect might work.
 
Javascript would mean relying on client technology, which is usually best avoided. You could do this like this:
Code:
------ form.html -------------------------

<form action="redirect.php" method="post">
 <input type="text" name="user" />
 <input type="submit" name="Find" />
</form>

------ redirect.php ----------------------

<?php

 $uri = "/myfamily/albums/";
 $uri .= $_POST['user'];
 $uri .= ".htm";

 header("Location: $uri");

?>
Hope it helps.
 
Thank you! that works perfectly.[smile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top