Forum Moderators: coopster

Message Too Old, No Replies

Simple (I think) script needed.

getting desperate here!

         

jmas49

12:08 pm on Mar 30, 2008 (gmt 0)

10+ Year Member



I'm trying to create a fairly simple (I think) php redirect.

I will have a one-box form requesting an 8 digit number that will vary depending on who enters it.

I need the redirect to go to a url that includes the number entered into the form box.

Example:

Data entered into form: 12345678

url for redirect: http://www.example.com/12345678/info

I believe this is pretty easy to do for someone who knows what they are doing (which apparently is not me!)

Thanks for the help :-)

[edited by: jatar_k at 1:16 pm (utc) on Mar. 30, 2008]
[edit reason] examplified url [/edit]

mehh

1:07 pm on Mar 30, 2008 (gmt 0)

10+ Year Member



I'm not entirely sure i get what you mean, but is this the sort of thing you are looking for?
<?php
header("Location: http://www.example.com/{$_GET['id']}/info");
?>

jmas49

1:51 pm on Mar 30, 2008 (gmt 0)

10+ Year Member



Thanks for the prompt reply! I suspect that is exactly what I need. Is the value after GET the name of the form box? I will punch it in and see what happens. Thanks again.

jmas49

3:36 pm on Mar 30, 2008 (gmt 0)

10+ Year Member



Hmmmmmm. Still a bit of a problem.

When I upload to the server, enter the required data into the form, and click "submit", it takes me to a blank page and the url address showing at the top is the website address that the form is on with the addition of the php file name instead of going to the target webpage. Puzzling indeed!

londrum

3:43 pm on Mar 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



GET will work if your form has
method=get
on it, but most people use
method=post
, so you could try changing it to
$_POST['id']

but why don't you post your code so we can see

jmas49

3:48 pm on Mar 30, 2008 (gmt 0)

10+ Year Member



UREKA!

It's working perfectly now. I changed from GET to POST and it works like a charm!

Thanks for the help.