This is my first project where I used Jquery. There are two pages 1. listofleaders.php 2. leadersprofile.php
On First Page i.e. listofleaders.php I have a input text box, where user enters leaders name and I used jQuery code to transfer textbox values to leaderprofile.php page
<html>
<head>
<script>
function ls()
{
var leaderdetails = "leaderprofile.php?lname="+$("#gopal").val();
$.get(leaderdetails, function( data ) {
//alert(leaderdetails);
location.href = "leaderprofile.php";
});
}
</script>
</head>
<body>
<input type="text" id="gopal" name="t" placeholder="Start Typing" size="50" />
<button onclick="ls();" type="button">Go!</button><br><br>
</body>
</html>
On Second Page leadersprofile.php I have written this,
<?php
include "admin/includes/dbconfig.php";
$lname = $_GET['lname'];
echo $lname;
?>
But on second page i.e. leaderprofile.php it is showing me error Undefined index : lname
Am I Correct to this approach ? Where I am Wrong ? Hope you Understand.
location.href = "leaderprofile.php";redirects you toleaderprofile.phpwithout parameters. What do you expect?location.href = "leaderprofile.php?parameter=value";?