I'm a beginner at php and I have a question. I'm using phpmyadmin for managing my database.
Here is a part of my code.
Code: Select all
<?php
if (isset($_POST['submit'])) // if form has been submitted
{
$name=$_POST['uname'];
$query = @mysql_query("SELECT * FROM admin WHERE username='$name'");
if (!$query) {
die('Could not execute query. Error: '.mysql_error());
}
$data = @mysql_fetch_assoc($query);
if (!$data) {
die('Could not fetch row, the username was not found. '.mysql_error());
}
header("Location: http://*****/edit.php");
}
?>
?>I want to be able to for example type
echo "Username: {$data['username']}";
in edit.php. But ofcourse the $data variable is not known in edit.php.
How can I bring that variable over to edit.php?
thanks in advance