Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 10th, 2007, 07:17 PM
Authorized User
 
Join Date: Sep 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help With PHP ?=name redirect.

How do I have a link to a page, and the page redirects based on whats after the http://www.blablabla.com/redirect.php?=name= ?

The link will go to redirect.php?=name=moose and redirect will automatically redirect to moose.html?

Does anyone know?

Visit my website at GladiatorStudios.com!
__________________
Visit my website at GladiatorStudios.com!
 
Old September 10th, 2007, 07:38 PM
Authorized User
 
Join Date: Sep 2007
Posts: 56
Thanks: 0
Thanked 1 Time in 1 Post
Default

After the ? mark you do not need an = sign.

Right after the question mark will be the variable name in your case name. Then comes the value

an example is http://yoursite.com/redirect.php?name=moose

in your php code to do the redirect would be

<?php
header("location: ".$_REQUEST["name"].".html");
?>

http://mynameissteve.com
 
Old September 10th, 2007, 07:45 PM
Authorized User
 
Join Date: Sep 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wow! Thanks! It worked!
 
Old September 10th, 2007, 07:46 PM
Authorized User
 
Join Date: Sep 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Although how would I get it to open in the target _blank?

Visit my website at GladiatorStudios.com!
 
Old September 12th, 2007, 02:32 AM
Authorized User
 
Join Date: Sep 2007
Posts: 56
Thanks: 0
Thanked 1 Time in 1 Post
Default

There actually isn't an option to specify the target of the window. You can do a javascript solution

http://mynameissteve.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirect SKhna ASP.NET 2.0 Basics 1 February 9th, 2008 08:14 AM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
redirect to new page using php glars PHP How-To 3 June 6th, 2005 02:59 AM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM
Hidden redirect but no php parsing klokkie Beginning PHP 2 August 5th, 2004 11:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.