Dear All,
im testing out a way to get data from database depending on the drop down selection and displaying the data into a table by using php. now my first issue which is really really frustrating me because i've done this dozens of time is that i get
Notice: Undefined index: place in D:\Xampp\htdocs\EMS2\testgetdrop.php on line 2
yeah i know a miniscule issue but its getting on my nerves as ive been doin coding for the entire day for a week anyway place
is defined as i usually define it
$place = mysql_real_escape_string($_POST['place']);
this is my test page:
<?php
$place = mysql_real_escape_string($_POST['place']);
if(isset($_POST['place']))
{
require "connection.php";
$retrieve = mysql_query("SELECT salutation,fname,lname FROM contact WHERE city LIKE %$place%") or die(mysql_error());
if($retrieve)
{
while($rows = mysql_fetch_array($retrieve))
{
$salutation = $rows['salutation'];
$fname= $rows['fname'];
$lname = $rows['lname'];
echo
"<table>
<thead>
<th>Name</th>
</thead>
<tr>
<td>$salutation $fname $lname</td>
</tr>
</table>";
}
}
}
?>
<html>
<body>
<form method="post" action="testgetdrop.php">
<select name="place">
<option value="" disabled selected>Choose</option>
<option value="Petaling Jaya">Petaling Jaya</option>
<option value="Kuching">Kuching</option>
</select>
</form>
</body>
</html>
and my other issue is that when a selection is made nothing happens. am i doing something wrong? or is this just not the right way of doing it?
thanks in advance for any help!
sincerely,
frustrated.