Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Christian Kroul
Christian Kroul
9,849 Points

PHP and reusing code

<?php
    $final[0]=array('base','india');
$final[1]=
array("id" => '?101', "img" => "img/building.jpg");
$final[2]=
array("id" => '?102','UK');
$final[3]=
array("id" => '?103','RUSSIA');
  ?>

<a href=<?php 
echo $final[1]["id"];
?>
> 
<img src="img/Hot-Dog.jpg">
</a>

 <?php 
 if ($_Get == $final[2]["id"]) {
     echo '<h1>AW</h1>';
 }
 ?>
<a href=<?php 
echo $final[2]["id"];
?>
>

<img style ="width: 30%;"
src="img/building.jpg">
</a>

This is my code it makes a new query with ?102 as the name, but it displays the same content i want each link to display something new, mayby a h1 tag for 102, and for 101 a paragraph tag. Any suggestions?

Not entirely clear what you're asking for here.

1 Answer

Christian Kroul
Christian Kroul
9,849 Points

Ok thanks guys i figured it out.