In my form i enter ID of student, which is located in database. On submit I send entered ID to external script, where i search for name of student with entered ID. This works, and after i echo it's name it's correct, but I don't know how to send data back to the my web page so I could read student's name with GET from address bar. Code:
$con=mysqli_connect("localhost","root","","novi-studomat");
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$id=$_POST['id'];
$exe="SELECT * FROM student WHERE id='$id'";
$query=mysqli_fetch_array(mysqli_query($con,$exe));
$ime=$query['name'];
I've tried with this:
header('Location:http://www.administrator.html.php?name=".$name."');
But it doesn't sends data to the page. This worked, but I think that there must be more elegant solution:
echo "<script>window.location.assign('http://www.administrator.html.php?name=".$name."'); </script>";
Location:http://www.administrator.html.php?name=".$name.". impressive<form>or ajax.