Well this is for the weapons in my game, some of which have space in their names, for example "Bolt Thrower" so when the link is...
<a href=$WEAPON[NAME] target=_blank>
The url is only /Bolt.php instead of Bolt_Thrower :-\ anyone know how this problem could be solved?
target=_blank Problem
Moderator: General Moderators
-
mindmeddler2002
- Forum Newbie
- Posts: 21
- Joined: Mon Nov 04, 2002 3:09 pm
- Location: US, PA, Harrisuburg
comparison chart?
Maybe make some header file, or include...
that checks the URL
have all the links go here...
linkexchance.php
that is just if u want to go to the corasponding page...
if u needed to save info from the last page, pass it back along
replace
with
another thing is that if $weapon is not in all the pages, as part of the link, u could place all the different vars, into a set.
this would prevent errors if u had a link go there without the weapon var set... but if u needed to vars to decide the corasponding link....
then its a bit more complicated, tell me if u use this!
laters
that checks the URL
have all the links go here...
linkexchance.php
Code: Select all
<?php
if ($weapon = "Bolt_Thrower") {$goto = "bolt.php"; }
if ($weapon = "Short_Sword") {$goto = "sword.php"; }
echo "<META HTTP-EQUIV=Refresh CONTENT=0;URL=$goto>";
?>if u needed to save info from the last page, pass it back along
replace
Code: Select all
echo "<META HTTP-EQUIV=Refresh CONTENT=0;URL=$goto>";Code: Select all
echo "<META HTTP-EQUIV=Refresh CONTENT=0;URL=$goto?weapon=$weapon&target=$target>";Code: Select all
if (isset($weapon)) {
if ($weapon = "Bolt_Thrower") {$goto = "bolt.php"; }
if ($weapon = "Short_Sword") {$goto = "sword.php"; }
}then its a bit more complicated, tell me if u use this!
laters
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Try using str_replace() to replace the spaces with underscores and don't forget to use quotes in your HTML:
would give you
Mac
Code: Select all
$WEAPONї'NAME'] = 'bolt thrower';
$href = str_replace(' ', '_', $WEAPONї'NAME']).'.php';
echo '<a href="'.$WEAPONї'NAME'].'" target="_blank">';Code: Select all
<a href="bolt_thrower.php" target="_blank">Re: target=_blank Problem
You are wrapping quotes around those A attributes, right?Karl wrote:<a href=$WEAPON[NAME] target=_blank>
Also, is $WEAPON an array? If so, is it a two-dimensional array?