Tuesday, 15 April 2014

php - How to fix a variable on a page -



php - How to fix a variable on a page -

i getting variable page when click on faculty link variable destroy. how prepare variable on page?

<ul> <?php if(isset($_get['a'])){$var=$_get['a'];};?> <li><a href='<?php if(isset($var)){echo $var;} ?>.php'><span><?php if(isset($var)) {echo $var." ";}?>home</span></a></li> <li><a href=''><span>hod</span></a></li> <li><a href='faculty.php?b=<?php if(isset($_get['a'])){echo $_get['a'];}?>'> <span>faculty</span></a></li> </ul>

your code perfect create sure url must have a index.php?a=somevalue.

<ul> <?php if(isset($_get['a'])) { $var=$_get['a']; ?> <li> <a href = ""<?php echo $var; ?>.php" rel=""> <span><?php echo $var." "; ?>home</span> </a> </li> <li><a href = ''><span>hod</span></a></li> <li> <a href = "faculty.php?b=<?php echo $var; ?>" rel=""> <span>faculty</span> </a> </li> <?php } ?> </ul>

php

No comments:

Post a Comment