[PHP] Create Links on the fly?

2003-05-29 Thread Chase
Salutations!

I am trying to do something fairly simple, but I can't seem to make it
work...  I want to have a form field on a page that the user will put in a 3
to 5 digit number and when they click on Submit that number will become
part of an URL that they are forwarded to.

For example, if the user put in the number 123, then when they click on
Submit they would be pushed to http://www.mypage.com/123.

Can anyone offer help??



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Create Links on the fly?

2003-05-29 Thread Justin French
if you wish to have this work purely with PHP, and not rely on client-side
stuff like javascript, then your only option (that i can see) is to create a
middle man script which translates their wishes.

startpage.html
---
html
...
form action='redirect.php' method='post'
input type='text' name='yourNumber' size='5' maxlength='5' /
input type='submit' name='submit' value='show' /
/form
...
/html
---

redirect.php
---
?
if($_POST['yourNumber'])
{
header(Location: http://mysite.com/dir/{$_POST['yourNumber']});
}
else
{
header(Location: startpage.html);
}
?
---


It can be done client side, IF you're willing to take on the risks and
uncertainties of relying on javascript, which i try to avoid wherever
possible.

You'll have to ask a JS list about that though :)


Justin French

on 29/05/03 4:20 AM, Chase ([EMAIL PROTECTED]) wrote:

 Salutations!
 
 I am trying to do something fairly simple, but I can't seem to make it
 work...  I want to have a form field on a page that the user will put in a 3
 to 5 digit number and when they click on Submit that number will become
 part of an URL that they are forwarded to.
 
 For example, if the user put in the number 123, then when they click on
 Submit they would be pushed to http://www.mypage.com/123.
 
 Can anyone offer help??
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php