I'm using MYSql database that outputs like this from my inner join query:
![enter image description here](https://i.stack.imgur.com/3JiFL.png)

Using this query (It works fine)

```
$result = mysql_query( "
select
   `account`.`name`, `customfield`.`value`, `note`.`occurredondatetime` noteid 
       from  (`note`, `activity`, `ownedsecurableitem` ownedsecurableitem1)
left join `activity_item` on `activity_item`.`activity_id` = `activity`.`id` 
  left join `item` on `item`.`id` = `activity_item`.`item_id` 
    left join `securableitem` on `securableitem`.`item_id` = `item`.`id` 
left join `ownedsecurableitem` on `ownedsecurableitem`.`securableitem_id` = `securableitem`.`id` 
  left join `account` on `account`.`ownedsecurableitem_id` = `ownedsecurableitem`.`id` 
    left join `_user` on `_user`.`id` = `ownedsecurableitem1`.`owner__user_id` 
left join `customfield` on `customfield`.`id` = `account`.`salecyclecstm_customfield_id`

where (`account`.`name` IS NOT NULL) 
  and `activity`.`id` = `note`.`activity_id` 
    and `ownedsecurableitem1`.`id` = `activity`.`ownedsecurableitem_id`
      and (`note`.`occurredondatetime` IS NOT NULL)
       and name='".$_POST['query']."'";

 ORDER BY occurredondatetime DESC

")

 or die("SELECT Error: ".mysql_error());    
  print "<table border=1 >\n";  
   $account = "Account";
    $sale = "Sale Cycle";
     $date = "Date";
      print "\t<td><bold><b>$account<b></td>\n";
       print "\t<td><bold><b>$sale<b></td>\n";
 print "\t<td><bold><b>$date<b></td>\n";
  while ($get_info = mysql_fetch_row($result)){  
   print "<P>";
    print "<tr>\n";  
     foreach ($get_info as $field) 
      print "\t<td>$field</td>\n";
       print "</tr>\n";  
        } 
         print "</table>\n";

```

**My question is:**
How would I create a form (Textbox input) that I can search the Account and it will out the Sale Cycle and Date fields (NOT IN A TABLE)? Ideally I would like it to output on the same page, so Java or Ajax?

I have : HTML

```
<form name="form1" id="form1" method="post" action="search.php"> //change here
Select Name :
<input type="text" name="query" /> 
<input type="submit" name="submit" id="submit" value="search" />
</form>

```

PHP

```
$query=mysql_query($select) or die($select);
$numrow=mysql_num_rows($query);
if($numrow != 0)
{
while($row=mysql_fetch_array($query))
{   
<?php echo $row['name'];
<?php echo $row['SalesStages'];

```