So, what I want to do it create a static drop down list with some persons name and I want it to do is
when a person’s name is selected I want it’s whole information from the database be visible.
For this I have:
- A database named ‘user_db’
- A table named ‘input_table’ on database ‘user_db’
- A simple form with select option named ‘select.php’
- A connection file named ‘select_connection.php’
- And a query file named ‘select_query.php’
Now what code I have made is:
- select.php
<form id="form1" name="form1" method="post" action="select_query.php">
List
<select name="select">
<option value="Asma">Asma</option>
<option value="Aasha">Aasha</option>
<option value="Raj">Raj</option>
<option value="Danial">Danial</option>
<option value="All">All</option>
</select>
<input type="submit" name="Submit" value="Submit" />
</form>
- select_connection.php
[php]
<?php $aa = mysql_connect("localhost","username","")… $ss= mysql_select_db("user_db"); ?>[/php]
3.select_query.php
[php]
[/php]
<table width="809" border="1">
<tr>
<td width="37">ID</td>
<td width="132">FIRST NAME </td>
<td width="158">LAST NAME </td>
<td width="109">SEX</td>
<td width="109">EMAIL</td>
<td width="109">PASSWORD</td>
<td width="109">COUNTRY</td>
</tr>
[php]
<?php while($row=mysql_fetch_array($que1)) { ?>[/php]
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['first_name']; ?></td>
<td><?php echo $row['last_name']; ?></td>
<td><?php echo $row['sex']; ?></td>
<td><?php echo $row['email']; ?></td>
<td><?php echo $row['password']; ?></td>
<td><?php echo $row['country']; ?></td>
</tr>
[php]
<?php } ?>[/php]
</table>
Main Question: Now, when I execute my file select.php whose action is select_query.php
I get error saying:
- Notice: Undefined variable: que1 in C:\wamp\www\database\select_query.php on line 26
- Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in C:\wamp\www\database\select_query.php on line 26
Kindly help with what and where I’m going wrong to display the required result.
Additionally: I’m using Dreamweaver 8 and Wamp server.