I have gone through some tutorials in W3Schools and others on HTML and PHP but I need a little clarity on how stuff works. I am trying to transport a value via URL using PHP from page1 to page2. Although I have a fair bit of idea on how to do it using HTML
Page1:
<form method="post" action="page2.php">
FIRST NAME <input type="text" name="fname"><br>
LAST NAME <input type="text" name="lname"><br>
<input type="submit" name="sub" value="sub">
</form>
Page2:
<?php
$fname=$_POST['fname'];
$lname=$_POST['lname'];
echo $fname."-".$lname;
?>
I want to use only PHP to transport values, I was planning to use a tag without using a form but I am sure it is not the right way because I won't be able to fetch values on page 2. Plz someone help me out clear these basics.
<?php
$name="hello world";
echo '<a href="page2.php?name='.$name.'"><input type="button name="sub" value="submit"></a>';
?>