Dynadot โ€” .com Registration $8.99

Need some Php help please

Spaceship Spaceship
Watch

edmarriner

Established Member
Impact
4
hi,

ok.. is there away to get a varible to have the value of another varible?

heres the code i have :
PHP:
<?php
//the varible club is on the end of the url on this page (out.php?club=leeds-united)
include("prem_links");//this file has a list of varibles one of which is $leeds-united.
$redirect="\$$club"; //takes the value of $club (leeds-united) and puts a $ infort of it making it a varible,  so redirect has the value $leeds-unted but theres a varilbe called leeds-unitedso it takes tht value (www.leedsunited.co.uk).
header("Refresh: 5; url=$redirect");// should ridirect to leedsunited.co.uk.
?>

any help will be VERY welcome. 20NP$ to anyone who finds a fix for it.

thanks,

-ed
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Code:
$redirect="\$$club";
replace with
Code:
$redirect ="\$".$club;
 
0
•••
hi,

sorry but that just did the same as my old code.

it gos to the url:

http://localhost/football/$arsenal

thanks for tring.
ill send you 5np$ anyway
 
0
•••
what's in the prem_links file?

edited:
nvm i'm checking it :)
 
0
•••
if you just want them to have the same value then it is just a case of doing:-

Code:
$redirect = $leeds-unted/CODE]

so now if $leeds-unted has the value of 10 so will $redirect.

I presume this is what you mean.
 
0
•••
edmarriner, i'm seeing your code and i'm a bit confused...

include("prem_links");
$redirect="\$$club";

you don't have a random to choose the club.
the prem_links should be prem_links.php

in the prem_links.php :
Code:
<?php
switch ($club) {
case arsenal:
   $redirect="www.arsenal.com";
   break;
case aston_villa:
   $redirect="www.avfc.co.uk";
   break;
case birmingham_city:
   $redirect="www.bcfc.com";
   break;
}
?>

on the page:
Code:
include("prem_links.php");
header("Refresh: 5; url=$redirect");

for the linking:
Code:
url_of_page.php?club=arsenal

this should solve your prob
 
Last edited:
0
•••
JFS said:
edmarriner, i'm seeing your code and i'm a bit confused...

include("prem_links");
$redirect="\$$club";

you don't have a random to choose the club.
the prem_links should be prem_links.php

in the prem_links.php :
Code:
<?php
switch ($club) {
case arsenal:
   $redirect="www.arsenal.com";
   break;
case aston_villa:
   $redirect="www.avfc.co.uk";
   break;
case birmingham_city:
   $redirect="www.bcfc.com";
   break;
}
?>

on the page:
Code:
include("prem_links.php");
header("Refresh: 5; url=$redirect");

for the linking:
Code:
url_of_page.php?club=arsenal

this should solve your prob

i have done this i can see how it would work but out.php just displays a blank page now.

here is the first few lines.

PHP:
<?php
include("prem_links.php");
header("Refresh: 5; url=$redirect");
echo "

if i do this it displays the page but i need to in include the file:

PHP:
<?php
header("Refresh: 5; url=$redirect");
echo "
 
0
•••
prem_links.php
Code:
<?php
switch ($club) {
case arsenal:
   $redirect="http://www.arsenal.com";
   break;
case aston_villa:
   $redirect="http://www.avfc.co.uk";
   break;
case birmingham_city:
   $redirect="http://www.bcfc.com";
   break;
}
?>

out.php
Code:
<?php
include("prem_links.php");
header("Refresh: 5; url=$redirect");
 ?>

and yes it opens first a black page because you want to...you can put refresh to 0 if you want...
 
Last edited:
0
•••
just did a little modifcation to prem_links and it works.

thanks

sent np$ to all who helped.
 
0
•••
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back