Languages :: PHP :: PHP text redirect |
|||
| By: PHP newbee |
Date: 25/09/2003 00:00:00 |
Points: 300 | Status: Answered Quality : Excellent |
|
hi i need some code in php to simply pop up a dialog box or submit from a form an number typed in by a user like a username and to have the script take that number and redirect there browaser to it as a url ge if thay type in 12345 and submit or ok it redirects them to <A HREF="http://www.domain.com/12345">http://www.domain.com/12345</a> |
|||
| By: VGR | Date: 25/09/2003 06:06:00 | Type : Answer |
|
| 1) popup AND form (you can comment fi "if cofirm" IMHO, just leave the location.href=...) <?php echo <<<EOS <script language=javascript> function go() { par=document.forms.main.dest.value; if confirm("do you wanna go to "+par+" ?") window.location.href=eval("<A HREF="http://www.domain.com/">http://www.domain.com/</a>"+par); } // go function </script> <form name=main> <input type=text name=dest value=""> <input type=button value="go to there" onClick="go();"> </form> EOS; ?> 2) you could also use a standard FORM and just use a action=redirect.php with the field "dest" this would be redirect.php : <?php Header("Location: <A HREF="http://www.domain.com/">http://www.domain.com/</a>{$_POST['dest']}"); ?> |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








