I just converted some of my HTML
pages to PHP
pages, and I\'m not that familiar with PHP
. In my HTML
pages, assuming it\'
Just try like this:
HTML in PHP :
$link_address1 = 'index.php';
echo "<a href='".$link_address1."'>Index Page</a>";
$link_address2 = 'page2.php';
echo "<a href='".$link_address2."'>Page 2</a>";
Easiest way
$link_address1 = 'index.php';
echo "<a href='$link_address1'>Index Page</a>";
$link_address2 = 'page2.php';
echo "<a href='$link_address2'>Page 2</a>";
Easiest:
<a href="page2.php">Link</a>
And if you need to pass a value:
<a href="page2.php?val=1">Link that pass the value 1</a>
To retrive the value put in page2.php this code:
<?php
$val = $_GET["val"];
?>
Now the variable $val
has the value 1
.
You can also used like this
<a href="<?php echo 'index.php'; ?>">Index Page</a>
<a href="<?php echo 'page2.php'; ?>">Page 2</a>
Use like this
<a href="index.php">Index Page</a>
<a href="page2.php">Page 2</a>
Html a tag
Link in html
<a href="index1.php">page1</a>
<a href="page2.php">page2</a>
Html in php
echo ' <a href="index1.php">page1</a>';
echo '<a href="page2.php">page2</a>';
echo "<a href='index.php'>Index Page</a>";
if you wanna use html tag like anchor tag you have to put in echo