Hi, I have been stuck with this problem for about a month now and find no answers for it online, as my php knowledge is of little experience i have ran out of methods to sort it out. So here I am asking you guys.
The problem:
Basically, I have two pages coded in php with html inside of them. One has a drop down menu that has students names from the database. The user simply clicks on one of them and click on the submit button to go onto the next page. On the next page is a styled content box with input fields which should display the databases information of that student they entered, but here is the problem, I cant get it to show the information!
Here is the code for the drop down page
<?php
include 'includes/connection.php';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="UTF-8" />
<title>DrivaSoft - Control Panel</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<div id="container">
<div id="logo"></div>
<div id="nav">
<ul class="menu">
<li id="manual"><a href="manual.php"><span>#</span></a></li>
<li id="drivasoft"><a href="http://drivasoft.co.uk"><span>#</span></a></li>
<li id="logout"><a href="logout.php"><span>#</span></a></li>
</ul>
</div>
<div id="custform" class="custform">
<form id="form" name="custform" method="post" action="editprocess.php">
<h1>Select Customer</h1>
<label>Name
<span class="small">Choose student by name</span>
</label>
<?php echo "<select name='select'>";
$query = "SELECT student FROM customers";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
while($row = mysql_fetch_assoc($result)){
echo '<option value='.$row['student'].' selected>'.$row['student'].'</option>';
}
echo "</select>";
?>
<button type="submit" class="submit" name="submit" id="submit">Select Customer</button>
<div class="spacer"></div>
</form>
</div>
</div>
</body>
</html>
Here is the code for the page which should display the info
<?php
include 'includes/connection.php';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="UTF-8" />
<title>DrivaSoft - Control Panel</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<div id="container">
<div id="logo"></div>
<div id="nav">
<ul class="menu">
<li id="manual"><a href="manual.php"><span>#</span></a></li>
<li id="drivasoft"><a href="http://drivasoft.co.uk"><span>#</span></a></li>
<li id="logout"><a href="logout.php"><span>#</span></a></li>
</ul>
</div>
<div id="latestcustcontent">
<div id="latestcustform" class="latestcustform">
<form id="form" name="custform" method="post" action="editsuccess.php">
<h1>Latest Customers</h1>
<label>ID
<span class="small">Student's ID</span>
</label>
<input type="text" name="editcustomer" id="editcustomer" value="<?php
$query = "SELECT id FROM customers WHERE student = ' " . $id . " ' ";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
$id = $_POST['student'];
$rr = $row['id'];
echo $rr; ?>" />
<label>Name
<span class="small">Student's name</span>
</label>
<input type="text" name="student" id="student" value="<?php $query = "SELECT * FROM customers WHERE student = ' " . $student . " ' ";
$result = mysql_query($query) or die (mysql_error());
$student = $_POST['student'];
while($row = mysql_fetch_assoc($result))
echo "" . $row['student'] . ""; ?>" />
<label>Date of Birth
<span class="small">Student's dob</span>
</label>
<input type="text" name="dob" id="dob" value="<?php $query = "SELECT * FROM customers WHERE student = ' " . $dob . " ' ";
$result = mysql_query($query) or die (mysql_error());
$dob = $_POST['student'];
while($row = mysql_fetch_assoc($result))
echo "" . $row['dob'] . ""; ?>" />
<label>Address
<span class="small">Add student's address</span>
</label>
<input type="text" name="student" id="student" value="<?php $query = "SELECT * FROM customers WHERE student = ' " . $phone . " ' ";
$result = mysql_query($query) or die (mysql_error());
$phone = $_POST['student'];
while($row = mysql_fetch_assoc($result))
echo "" . $row['phone'] . ""; ?>" />
<label>Post Code
<span class="small">Add student's post code</span>
</label>
<input type="text" name="student" id="student" value="<?php $query = "SELECT * FROM customers WHERE student = ' " . $postcode . " ' ";
$result = mysql_query($query) or die (mysql_error());
$postcode = $_POST['student'];
$row = mysql_fetch_assoc($result);
while($row = mysql_fetch_assoc($result)){
echo "" . $row['postcode'] . "";
}
?>" />
<label>Theory Test
<span class="small">Add student's theory test date</span>
</label>
<input type="text" name="student" id="theory test" value="<?php $query = "SELECT * FROM customers WHERE student = ' " . $theory . " ' ";
$result = mysql_query($query) or die (mysql_error());
$theory = $_POST['student'];
while($row = mysql_fetch_assoc($result)){
echo "" . $row['theory test'] . "";} ?>" />
<label>Practical Test
<span class="small">Add student's practical test Date</span>
</label>
<input type="text" name="practical test" id="practical test" value="<?php $query = "SELECT * FROM customers WHERE student = ' " . $prac . " ' ";
$result = mysql_query($query) or die (mysql_error());
$prac = $_POST['student'];
while($row = mysql_fetch_assoc($result)){
echo "" . $row['practical test'] . "";} ?>" />
<label>Theory Test Status
<span class="small">Has the student already passed?</span>
</label>
<input type="text" name="theory passed" id="theory passed" value="<?php $query = "SELECT * FROM customers WHERE student = ' " . $thoerypass . " ' ";
$result = mysql_query($query) or die (mysql_error());
$theorypass = $_POST['student'];
while($row = mysql_fetch_assoc($result)){
echo "" . $row['theory passed'] . "";} ?>" />
<label>Practical Test Status
<span class="small">Has the student already passed?</span>
</label>
<input type="text" name="practical passed" id="practical passed" value="<?php $query = "SELECT * FROM customers WHERE student = ' " . $pracpass . " ' ";
$result = mysql_query($query) or die (mysql_error());
$pracpass = $_POST['student'];
while($row = mysql_fetch_assoc($result)){
echo "" . $row['practical passed'] . "";} ?>" />
<button type="submit" class="editsubmit" name="editsubmit" id="editsubmit">Update Customer</button>
<div class="spacer"></div>
</form>
</div>
</div>
</div>
</body>
</html>
I would appreciate any help