Re: Create Links on the fly?

From: Date: Thu, 29 May 2003 00:37:02 +0000
Subject: Re: Create Links on the fly?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-149333@lists.php.net to get a copy of this message
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 (chase@graewolfe.com) 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?? > >

« previous php.general (#149333) next »