milkmycow
05-29-2003, 01:21 PM
how can i make an input box, that say someone enters 943 and it fowards them to www.mydomain.com/pages/943 ?
i REALLY need this guys! help me out!
i REALLY need this guys! help me out!
![]() | View Full Version : how can i redirect via input? milkmycow 05-29-2003, 01:21 PM how can i make an input box, that say someone enters 943 and it fowards them to www.mydomain.com/pages/943 ? i REALLY need this guys! help me out! aingaran 05-29-2003, 02:10 PM I'm not sure, but I think this should work. <? if ($go) { $url = 'http://www.yourdomain.com/pages/$page'; header("Location: $url") } else { echo " <form actio=$PHP_SELF method=post> Enter Page #: <input type=text name=page><br> <input type=submit name=go value=go> </form> "; } ?> Sheps 05-29-2003, 02:11 PM PHP script... Name it redirect.php <? if( isset($HTTP_POST_VARS['page_number']) ) { header("Location: /pages/".$HTTP_POST_VARS['page_number']."/"); } else { die("Please input the number//This page cannot be called directly"); } ?> Then make the form and the action would be /redirect.php ClosetPaci 05-29-2003, 02:16 PM If I understand what you're looking for, this ought to work. Assuming the file is 'script.php'... <?php if(isset($_POST['theRedirect']) { header("Location:http://www.example.com/" . $_POST['theRedirect']); /* Redirect browser */ exit; } ?> <form name="redirect" method="post" action="./script.php"> redirect:<input type="text" name="theRedirect"> <input type="submit" value="submit"> EDIT: Dratted [url] popping up there! milkmycow 05-29-2003, 02:20 PM sorry guys i dont know ANYTHING really about forms, so im lost and still cant get this working. milkmycow 05-29-2003, 04:28 PM I cant get any of those to work guys :( can someone message me on aim and help me out? my sn is retardkeith TalonKarrde 05-29-2003, 07:44 PM Originally posted by aingaran I'm not sure, but I think this should work. <? if ($go) { $url = 'http://www.yourdomain.com/pages/$page'; header("Location: $url") } else { echo " <form actio=$PHP_SELF method=post> Enter Page #: <input type=text name=page><br> <input type=submit name=go value=go> </form> "; } ?> You don't have anything set to define $page .... :P milkmycow 05-29-2003, 08:06 PM http://www.buenavista-homes.com/viewyourhome.html |