File1:
<?php
$home['1']='home/1.php'
$home['2']='home/2.php'
?>
File2:
<?php
Include File1.php
<a href="<?php echo $home['1']; ?>">home 1</a>
?>
Whats wrong is that simple script?
Can someone help me little bit ?
get link filename another file.
Moderators: egami, macek, gesf
-
- php-forum Fan User
- Posts: 973
- Joined: Mon Oct 01, 2012 12:32 pm
you've actually got a pretty good number of errors crammed into that tiny little script. from top here we go:
1) you're not ending your statements in the php sections with semicolons
2) you've capitalized 'Include' and have not quoted the filename to be included
3) you are writing markup without echoing it out '<a href=...'
4 & 5) you open a new php block inside of a php block, and you are using echo to try to concatenate strings within a statement
1) you're not ending your statements in the php sections with semicolons
2) you've capitalized 'Include' and have not quoted the filename to be included
3) you are writing markup without echoing it out '<a href=...'
4 & 5) you open a new php block inside of a php block, and you are using echo to try to concatenate strings within a statement
-
- php-forum Fan User
- Posts: 973
- Joined: Mon Oct 01, 2012 12:32 pm
You've rectified #1 in the first section, #2 is good (though the line needs to end with a semicolon) #3 is not addressed, and #5 is improperly addressed. concatenation in php is done using a period.
You should also be aware that you're not outputting anything from either code block, and even once you address #3, your output will be...
You should also be aware that you're not outputting anything from either code block, and even once you address #3, your output will be...
and Home 1 will be a linkFile1:File2Home 1